/** * Schedule a removal only after the underlying database flushes. * <p> * Unlike {@link #remove(CacheKey)}, these removals are buffered until the * application calls {@link #flush()} and aren't sent to the cache service * until after the underlying database flush() operation is completed * successfully. * * @param key * key to remove. */ public void removeAfterFlush(CacheKey key) { if (afterFlush == null) afterFlush = newList(); afterFlush.add(CacheService.Change.remove(key)); }
/** * Schedule a removal only after the underlying database flushes. * <p> * Unlike {@link #remove(CacheKey)}, these removals are buffered until the * application calls {@link #flush()} and aren't sent to the cache service * until after the underlying database flush() operation is completed * successfully. * * @param key * key to remove. */ public void removeAfterFlush(CacheKey key) { if (afterFlush == null) afterFlush = newList(); afterFlush.add(CacheService.Change.remove(key)); }
/** * Schedule any cache change. * * @param op * the cache operation. * @throws DhtException * a prior flush failed. */ public void modify(CacheService.Change op) throws DhtException { int sz = op.getKey().getBytes().length; if (op.getData() != null) sz += op.getData().length; if (add(sz)) { if (pending == null) pending = newList(); pending.add(op); queued(sz); } else { client.modify(singleton(op), wrap(none, sz)); } }
/** * Schedule any cache change. * * @param op * the cache operation. * @throws DhtException * a prior flush failed. */ public void modify(CacheService.Change op) throws DhtException { int sz = op.getKey().getBytes().length; if (op.getData() != null) sz += op.getData().length; if (add(sz)) { if (pending == null) pending = newList(); pending.add(op); queued(sz); } else { client.modify(singleton(op), wrap(none, sz)); } }