| java.lang.Object com.quadcap.sql.file.Cache
All known Subclasses: com.quadcap.sql.file.BlockCache,
Cache | abstract public class Cache (Code) | | This class manages a number of buffers on an underlying store.
What about write-through policies?
author: Stan Bailes |
Method Summary | |
public void | flush() Flush all modified items back to the underlying store. | public Object | get(int key) Get the specified object from the cache, if available; from the
underlying store if not. | public Cacheable | getCacheable(long key) Search the cache for the specified key and return the associated
cache item if one was found. | public void | init(Object store, int size) Initialize the cache. | public boolean | isReadOnly() | abstract public Cacheable | makeCacheable() Factory to create an empty cache slot. | public void | put(int key, Object val) Store the object in the cache. | public void | revert() | public void | setLock(Object lock) Specify the lock-object to be used to synchronize access to the
cache. | public void | setReadOnly(boolean v) | public void | show(PrintWriter os) |
readOnly | boolean readOnly(Code) | | |
flush | public void flush() throws IOException(Code) | | Flush all modified items back to the underlying store.
|
get | public Object get(int key) throws IOException(Code) | | Get the specified object from the cache, if available; from the
underlying store if not. In any case, the object (if found)
should be in the cache after this call.
If the object isn't in the cache OR the underlying store,
this method should return null, and the contents of both the cache
and the underlying store should remain unchanged.
This implementation doesn't change the underlying store, but
the cache ends up holding a CacheItem with a null data component.
Parameters: key - the search key return the data associated with the key |
getCacheable | public Cacheable getCacheable(long key) throws IOException(Code) | | Search the cache for the specified key and return the associated
cache item if one was found. Otherwise, find a free cache item
and initialize it from the underlying store.
Parameters: key - the search key the cache item associated with the specified key. |
init | public void init(Object store, int size)(Code) | | Initialize the cache.
Parameters: s - the underlying store Parameters: size - the size of the cache |
isReadOnly | public boolean isReadOnly()(Code) | | Am I read only?
|
makeCacheable | abstract public Cacheable makeCacheable()(Code) | | Factory to create an empty cache slot. Only a fixed number of
cache slots should be created, and they should then be recycled,
never destroyed.
|
put | public void put(int key, Object val) throws IOException(Code) | | Store the object in the cache. The object will be marked dirty,
and will eventually be written back to the underlying store.
|
revert | public void revert()(Code) | | |
setLock | public void setLock(Object lock)(Code) | | Specify the lock-object to be used to synchronize access to the
cache. If the lock isn't specified, it defaults to the cache
object itself.
Parameters: lock - the lock object |
setReadOnly | public void setReadOnly(boolean v)(Code) | | Set the 'read only' flag
|
|
|