![]() |
Quadcap Embeddable Database |
Inheritance diagram for com.quadcap.sql.file.Cache:

What about write-through policies?
Definition at line 63 of file Cache.java.
Public Member Functions | |
| void | init (Object store, int size) |
| Initialize the cache. | |
| boolean | isReadOnly () |
| Am I read only? | |
| void | setReadOnly (boolean v) |
| Set the 'read only' flag. | |
| void | setLock (Object lock) |
| Specify the lock-object to be used to synchronize access to the cache. | |
| Cacheable | getCacheable (long key) throws IOException |
| Search the cache for the specified key and return the associated cache item if one was found. | |
| Object | get (int key) throws IOException |
| Get the specified object from the cache, if available; from the underlying store if not. | |
| void | put (int key, Object val) throws IOException |
| Store the object in the cache. | |
| abstract Cacheable | makeCacheable () |
| Factory to create an empty cache slot. | |
| void | flush () throws IOException |
| Flush all modified items back to the underlying store. | |
| void | revert () |
| void | show (PrintWriter os) |
Package Attributes | |
| Object | store |
| Object | lock |
| int | size |
| boolean | readOnly |
| LongMap | t |
| Map long -> Cacheable. | |
| DList | lru = new DList() |
| LRU list of free cache items. | |
Private Member Functions | |
| final Cacheable | getCacheable () throws IOException |
| Find a free cache slot. | |
|
|
Flush all modified items back to the underlying store.
Definition at line 235 of file Cache.java. References com.quadcap.sql.file.Cacheable.flush(), com.quadcap.sql.file.Cache.lock, com.quadcap.sql.file.Cache.lru, com.quadcap.util.DListItem.next, and com.quadcap.util.DListItem.obj. Referenced by com.quadcap.sql.file.BlockFile.flush(). |
|
|
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.
Definition at line 164 of file Cache.java. References com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.Cache.get(), com.quadcap.sql.file.Cache.getCacheable(), com.quadcap.sql.file.Cacheable.getData(), and com.quadcap.sql.file.Cache.lock. Referenced by com.quadcap.sql.file.Cache.get(). |
|
|
Find a free cache slot. If necessary, seize an existing cache slot, with preference for the "least recently used" item. This function should only be called if the lock on the cache is held by this thread. Definition at line 205 of file Cache.java. References com.quadcap.sql.file.Cacheable.flush(), com.quadcap.sql.file.Cacheable.getKey(), com.quadcap.sql.file.Cacheable.getRefCount(), com.quadcap.sql.file.Cacheable.isDirty(), com.quadcap.sql.file.Cache.lru, com.quadcap.sql.file.Cache.makeCacheable(), com.quadcap.util.DListItem.obj, com.quadcap.util.DListItem.prev, com.quadcap.sql.file.Cacheable.setDListItem(), com.quadcap.sql.file.Cache.size, and com.quadcap.sql.file.Cache.t. Referenced by com.quadcap.sql.file.Cache.get(), com.quadcap.sql.file.Cache.getCacheable(), and com.quadcap.sql.file.Cache.put(). |
|
|
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.
Definition at line 122 of file Cache.java. References com.quadcap.sql.file.Cache.getCacheable(), com.quadcap.sql.file.Cacheable.getDListItem(), com.quadcap.sql.file.Cacheable.incrRefCount(), com.quadcap.sql.file.Cacheable.init(), com.quadcap.sql.file.Cache.lock, com.quadcap.sql.file.Cache.lru, com.quadcap.sql.file.Cache.readOnly, com.quadcap.sql.file.Cacheable.setReadOnly(), com.quadcap.sql.file.Cache.size, com.quadcap.sql.file.Cache.store, and com.quadcap.sql.file.Cache.t. Referenced by com.quadcap.sql.file.BlockFile.getPage(). |
|
||||||||||||
|
Initialize the cache.
Definition at line 85 of file Cache.java. References com.quadcap.sql.file.Cache.init(), com.quadcap.sql.file.Cache.lru, and com.quadcap.sql.file.Cache.t. Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), and com.quadcap.sql.file.Cache.init(). |
|
|
Am I read only?
Definition at line 96 of file Cache.java. References com.quadcap.sql.file.Cache.readOnly. |
|
|
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. Implemented in com.quadcap.sql.file.BlockCache. Referenced by com.quadcap.sql.file.Cache.getCacheable(). |
|
||||||||||||
|
Store the object in the cache. The object will be marked dirty, and will eventually be written back to the underlying store. Definition at line 181 of file Cache.java. References com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.Cache.getCacheable(), com.quadcap.sql.file.Cache.lock, com.quadcap.sql.file.Cache.put(), and com.quadcap.sql.file.Cacheable.setData(). Referenced by com.quadcap.sql.file.Cache.put(). |
|
|
Definition at line 249 of file Cache.java. References com.quadcap.sql.file.Cache.lock, com.quadcap.sql.file.Cache.lru, com.quadcap.sql.file.Cache.size, and com.quadcap.sql.file.Cache.store. Referenced by com.quadcap.sql.file.BlockFile.revert(). |
|
|
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.
Definition at line 110 of file Cache.java. References com.quadcap.sql.file.Cache.setLock(). Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), and com.quadcap.sql.file.Cache.setLock(). |
|
|
Set the 'read only' flag.
Definition at line 101 of file Cache.java. References com.quadcap.sql.file.Cache.setReadOnly(). Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), and com.quadcap.sql.file.Cache.setReadOnly(). |
|
|
Definition at line 256 of file Cache.java. References com.quadcap.sql.file.Cache.lock, com.quadcap.sql.file.Cache.lru, and com.quadcap.sql.file.Cache.show(). Referenced by com.quadcap.sql.file.Cache.show(), and com.quadcap.sql.file.BlockFile.showCache(). |
|
|
Definition at line 65 of file Cache.java. Referenced by com.quadcap.sql.file.Cache.flush(), com.quadcap.sql.file.Cache.get(), com.quadcap.sql.file.Cache.getCacheable(), com.quadcap.sql.file.Cache.put(), com.quadcap.sql.file.Cache.revert(), and com.quadcap.sql.file.Cache.show(). |
|
|
LRU list of free cache items.
Definition at line 77 of file Cache.java. Referenced by com.quadcap.sql.file.Cache.flush(), com.quadcap.sql.file.Cache.getCacheable(), com.quadcap.sql.file.Cache.init(), com.quadcap.sql.file.Cache.revert(), and com.quadcap.sql.file.Cache.show(). |
|
|
Definition at line 67 of file Cache.java. Referenced by com.quadcap.sql.file.Cache.getCacheable(), and com.quadcap.sql.file.Cache.isReadOnly(). |
|
|
Definition at line 66 of file Cache.java. Referenced by com.quadcap.sql.file.Cache.getCacheable(), and com.quadcap.sql.file.Cache.revert(). |
|
|
Definition at line 64 of file Cache.java. Referenced by com.quadcap.sql.file.Cache.getCacheable(), and com.quadcap.sql.file.Cache.revert(). |
|
|
Map long -> Cacheable.
Definition at line 72 of file Cache.java. Referenced by com.quadcap.sql.file.Cache.getCacheable(), and com.quadcap.sql.file.Cache.init(). |