/** * Initialize a put operation. * * @param key * the key to store. * @param data * the value to store. * @return the operation. */ public static Change put(CacheKey key, byte[] data) { return new Change(Type.PUT, key, data); }
public void remove(ChunkKey key, WriteBuffer buffer) throws DhtException { CacheBuffer buf = (CacheBuffer) buffer; buf.remove(nsChunk.key(key)); buf.remove(nsMeta.key(key)); db.remove(key, buf.getWriteBuffer()); }
public void put(RepositoryKey repo, CachedPackInfo info, WriteBuffer buffer) throws DhtException { CacheBuffer buf = (CacheBuffer) buffer; db.put(repo, info, buf.getWriteBuffer()); buf.removeAfterFlush(nsCachedPack.key(repo)); }
/** * Construct a MemKey within this namespace. * * @param key * the key to include. * @return key within this namespace. */ public CacheKey key(byte[] key) { return new CacheKey(this, key); }
/** * Create a namespace from a byte array. * * @param name * the name to wrap. * @return the namespace. */ public static Namespace create(byte[] name) { return new Namespace(name); }
public void remove(ObjectIndexKey objId, ChunkKey chunk, WriteBuffer buffer) throws DhtException { CacheBuffer buf = (CacheBuffer) buffer; db.remove(objId, chunk, buf.getWriteBuffer()); // TODO This suffers from a race condition. The removal from the // cache can occur before the database update takes place, and a // concurrent reader might re-populate the cache with the stale data. // buf.remove(ns.key(objId)); }
public void put(RepositoryKey repo, CachedPackInfo info, WriteBuffer buffer) throws DhtException { CacheBuffer buf = (CacheBuffer) buffer; db.put(repo, info, buf.getWriteBuffer()); buf.removeAfterFlush(nsCachedPack.key(repo)); }
/** * Initialize a put operation. * * @param key * the key to store. * @param data * the value to store. * @return the operation. */ public static Change putIfAbsent(CacheKey key, byte[] data) { return new Change(Type.PUT_IF_ABSENT, key, data); }
/** * Construct a MemKey within this namespace. * * @param key * the key to include. * @return key within this namespace. */ public CacheKey key(RowKey key) { return new CacheKey(this, key); }
/** * Create a namespace from a byte array. * * @param name * the name to wrap. * @return the namespace. */ public static Namespace create(byte[] name) { return new Namespace(name); }
/** * Initialize a put operation. * * @param key * the key to store. * @param data * the value to store. * @return the operation. */ public static Change put(CacheKey key, byte[] data) { return new Change(Type.PUT, key, data); }
/** * Construct a MemKey within this namespace. * * @param key * the key to include. * @return key within this namespace. */ public CacheKey key(byte[] key) { return new CacheKey(this, key); }
/** * Initialize a put operation. * * @param key * the key to store. * @param data * the value to store. * @return the operation. */ public static Change putIfAbsent(CacheKey key, byte[] data) { return new Change(Type.PUT_IF_ABSENT, key, data); }
/** * Initialize a remove operation. * * @param key * the key to remove. * @return the operation. */ public static Change remove(CacheKey key) { return new Change(Type.REMOVE, key, null); }