![]() |
Quadcap Embeddable Server |
What about write-through policies?
Definition at line 60 of file Cache.java.
Public Member Functions | |
| void | init (Object store, int size) |
| Initialize the cache. | |
| void | setLock (Object lock) |
| Specify the lock-object to be used to synchronize access to the cache. | |
| Cacheable | getCacheable (Object key) throws IOException |
| Search the cache for the specified key and return the associated cache item if one was found. | |
| Object | get (Object key) throws IOException |
| Get the specified object from the cache, if available; from the underlying store if not. | |
| void | put (Object 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 | show (PrintWriter os) |
Package Functions | |
| void | checkCache () |
| Cacheable | getCacheable () throws IOException |
| Find a free cache slot. | |
Package Attributes | |
| Object | store |
| Object | lock |
| int | size |
| Hashtable | t |
| DList | lru = new DList() |
|
|
|
Flush all modified items back to the underlying store.
Definition at line 248 of file Cache.java. References com.quadcap.util.collections.Cacheable.flush(), com.quadcap.util.DList.head, com.quadcap.util.collections.Cache.lock, com.quadcap.util.collections.Cache.lru, com.quadcap.util.DListItem.next, and com.quadcap.util.DListItem.obj. |
|
|
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 173 of file Cache.java. References com.quadcap.util.collections.Cacheable.decrRefCount(), com.quadcap.util.collections.Cache.get(), com.quadcap.util.collections.Cache.getCacheable(), com.quadcap.util.collections.Cacheable.getData(), and com.quadcap.util.collections.Cache.lock. Referenced by com.quadcap.util.collections.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 214 of file Cache.java. References com.quadcap.util.collections.Cacheable.flush(), com.quadcap.util.collections.Cacheable.getKey(), com.quadcap.util.collections.Cacheable.getRefCount(), com.quadcap.util.DList.head, com.quadcap.util.collections.Cacheable.isDirty(), com.quadcap.util.collections.Cache.lru, com.quadcap.util.collections.Cache.makeCacheable(), com.quadcap.util.DListItem.obj, com.quadcap.util.DListItem.prev, com.quadcap.util.collections.Cacheable.setDListItem(), com.quadcap.util.collections.Cache.show(), com.quadcap.util.collections.Cache.t, and com.quadcap.util.DList.tail(). Referenced by com.quadcap.util.collections.Cache.get(), com.quadcap.util.collections.Cache.getCacheable(), and com.quadcap.util.collections.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 101 of file Cache.java. References com.quadcap.util.collections.Cache.getCacheable(), com.quadcap.util.collections.Cacheable.getDListItem(), com.quadcap.util.collections.Cacheable.incrRefCount(), com.quadcap.util.collections.Cacheable.init(), com.quadcap.util.collections.Cache.lock, com.quadcap.util.collections.Cache.lru, com.quadcap.util.DList.moveFront(), com.quadcap.util.collections.Cache.store, and com.quadcap.util.collections.Cache.t. |
|
||||||||||||
|
Initialize the cache.
Definition at line 74 of file Cache.java. References com.quadcap.util.collections.Cache.init(), com.quadcap.util.collections.Cache.lru, com.quadcap.util.DList.resize(), and com.quadcap.util.collections.Cache.t. Referenced by com.quadcap.util.collections.Cache.init(). |
|
|
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. Referenced by com.quadcap.util.collections.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 190 of file Cache.java. References com.quadcap.util.collections.Cacheable.decrRefCount(), com.quadcap.util.collections.Cache.getCacheable(), com.quadcap.util.collections.Cache.lock, com.quadcap.util.collections.Cache.put(), and com.quadcap.util.collections.Cacheable.setData(). Referenced by com.quadcap.util.collections.Cache.put(). |
|
|
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 89 of file Cache.java. References com.quadcap.util.collections.Cache.setLock(). Referenced by com.quadcap.util.collections.Cache.setLock(). |
|
|
Definition at line 266 of file Cache.java. References com.quadcap.util.collections.Cache.lock, com.quadcap.util.collections.Cache.lru, com.quadcap.util.DList.show(), and com.quadcap.util.collections.Cache.show(). Referenced by com.quadcap.util.collections.Cache.getCacheable(), and com.quadcap.util.collections.Cache.show(). |
|
|
|
|
Definition at line 63 of file Cache.java. |
|
|
Definition at line 61 of file Cache.java. Referenced by com.quadcap.util.collections.Cache.getCacheable(). |
|
|
Definition at line 65 of file Cache.java. Referenced by com.quadcap.util.collections.Cache.checkCache(), com.quadcap.util.collections.Cache.getCacheable(), and com.quadcap.util.collections.Cache.init(). |