|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.rep.impl.node.DbCache
public class DbCache
Cache used to maintain DatabaseImpl handles. The cache retains some configurable number of MRU entries. In addition, the cache will discard MRU entries that have not been used within a configurable timeout period.
Implementation notes:
Constructor Summary | |
---|---|
DbCache(DbTree dbTree,
int maxEntries,
int timeoutMs)
Creates an instance of a DbCache. |
Method Summary | |
---|---|
void |
clear()
Clears out the cache releasing db handles as well |
DatabaseImpl |
get(DatabaseId dbId,
Txn txn)
Returns the DatabaseImpl associated with the dbId, caching the return value, if it's not already cached. |
(package private) LinkedHashMap<DatabaseId,com.sleepycat.je.rep.impl.node.DbCache.Info> |
getMap()
|
int |
getMaxEntries()
Returns the max entries that can be held by the cache. |
int |
getTimeoutMs()
Returns the configured timeout in ms. |
void |
setConfig(RepConfigManager configMgr)
Updates the configuration of the db cache, by resetting maxEntries and timeoutMs to the configured
values. |
void |
tick()
The tick() method forms the basis for removing stale entries from the cache. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
DbCache(DbTree dbTree, int maxEntries, int timeoutMs)
dbTree
- the source of the data being cachedmaxEntries
- the max MRU entries to be retained in the cachetimeoutMs
- the timeout used to remove stale entries. A timeout
value of zero means that each call to tick() will move the "clock"
forward. It's useful for testing purposes.Method Detail |
---|
public void tick()
public DatabaseImpl get(DatabaseId dbId, Txn txn)
dbId
- the dbId that is to be resolved.
public void setConfig(RepConfigManager configMgr)
maxEntries
and timeoutMs
to the configured
values.
Note that setting the cache to a smaller max entry does not immediately
reduce the number of entries currently in the cache, if the size of the
cache is already at the maximum. The reduction will take place
incrementally over time, as calls to "put" operations are made and
DbCacheLinkedHashMap#removeEldestEntry
is invoked for each put
operation. This incremental cache size reduction is not expected to be a
significant drawback in practice.
configMgr
- the configuration holding the cache parameterspublic int getMaxEntries()
public int getTimeoutMs()
public void clear()
LinkedHashMap<DatabaseId,com.sleepycat.je.rep.impl.node.DbCache.Info> getMap()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |