public class DbCache extends Object
Implementation notes:
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.
|
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()
Copyright © 2024. All rights reserved.