Top Description Fields Constructors Methods
com.mchange.v1.cachedstore

pack-priv Class SimpleWritableCachedStore

extends Object
implements WritableCachedStore
Class Inheritance
All Implemented Interfaces
com.mchange.v1.cachedstore.WritableCachedStore, com.mchange.v1.cachedstore.CachedStore
Imports
java.util.*

Not thread-safe... use synchronized wrapper in multithreaded situations

Field Summary

Modifier and TypeField and Description
pack-priv Set<E>
pack-priv WritableCachedStore.Manager
pack-priv TweakableCachedStore
private static final Object
pack-priv HashMap<K, V>

Constructor Summary

AccessConstructor and Description
pack-priv
SimpleWritableCachedStore(TweakableCachedStore readOnlyCache, WritableCachedStore.Manager manager)

the readOnlyCache MUST use manager for its CachedStore.Manager...

Method Summary

Modifier and TypeMethod and Description
public void
clearPendingWrites()

Implements com.mchange.v1.cachedstore.WritableCachedStore.clearPendingWrites.

Clears any pending (unflushed or failed) writes and removes.

public Object
public void
flushWrites()

Implements com.mchange.v1.cachedstore.WritableCachedStore.flushWrites.

flushes writes to back end, IN NO PARTICULAR ORDER!

public Set<E>
public void
public void
reset()

Implements com.mchange.v1.cachedstore.WritableCachedStore.reset.

Clears (WITHOUT WRITING) any pending (unflushed or failed) writes and removes, and any cached reads.

public void
sync()

Implements com.mchange.v1.cachedstore.WritableCachedStore.sync.

flushes writes and then clears cached reads.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

failedWritesback to summary
pack-priv Set<E> failedWrites
managerback to summary
pack-priv WritableCachedStore.Manager manager
readOnlyCacheback to summary
pack-priv TweakableCachedStore readOnlyCache
REMOVE_TOKENback to summary
private static final Object REMOVE_TOKEN
writeCacheback to summary
pack-priv HashMap<K, V> writeCache

Constructor Detail

SimpleWritableCachedStoreback to summary
pack-priv SimpleWritableCachedStore(TweakableCachedStore readOnlyCache, WritableCachedStore.Manager manager)

the readOnlyCache MUST use manager for its CachedStore.Manager...

Method Detail

clearPendingWritesback to summary
public void clearPendingWrites()

Implements com.mchange.v1.cachedstore.WritableCachedStore.clearPendingWrites.

Doc from com.mchange.v1.cachedstore.WritableCachedStore.clearPendingWrites.

Clears any pending (unflushed or failed) writes and removes.

findback to summary
public Object find(Object key) throws CachedStoreException

Implements com.mchange.v1.cachedstore.CachedStore.find.

flushWritesback to summary
public void flushWrites() throws CacheFlushException

Implements com.mchange.v1.cachedstore.WritableCachedStore.flushWrites.

Doc from com.mchange.v1.cachedstore.WritableCachedStore.flushWrites.

flushes writes to back end, IN NO PARTICULAR ORDER! (If you write a key twice, the second write reliably supercedes the first, however.) If this method fails, you can use getFailedWrites() to see what keys could not be written. Values that failed to write are still "pending": they will attempt to write on the next flush, and will still be read from the cache. Use clearPendingWrites() to avoid seeing or writing these values again.

getFailedWritesback to summary
public Set<E> getFailedWrites()

Implements com.mchange.v1.cachedstore.WritableCachedStore.getFailedWrites.

Returns:Set<E>

Doc from com.mchange.v1.cachedstore.WritableCachedStore.getFailedWrites.

null if all attempts to write to backend storage have succeeded, an unmodifiable Set of keys otherwise. failedWrites includes keys for whom a call to write or remove initially succeeded, but an attempt to flush the write to storage failed. A failed write may be any of an attempted first write, overwrite, or remove.

removeback to summary
public void remove(Object key)

Implements com.mchange.v1.cachedstore.WritableCachedStore.remove.

resetback to summary
public void reset() throws CachedStoreException

Implements com.mchange.v1.cachedstore.WritableCachedStore.reset.

Doc from com.mchange.v1.cachedstore.WritableCachedStore.reset.

Clears (WITHOUT WRITING) any pending (unflushed or failed) writes and removes, and any cached reads.

syncback to summary
public void sync() throws CachedStoreException

Implements com.mchange.v1.cachedstore.WritableCachedStore.sync.

Doc from com.mchange.v1.cachedstore.WritableCachedStore.sync.

flushes writes and then clears cached reads. On successful completion, the cache and the back-end store will be in sync with one another.

writeback to summary
public void write(Object key, Object value)

Implements com.mchange.v1.cachedstore.WritableCachedStore.write.