public class DatabaseCacheImpl extends Object implements DatabaseCache
DatabaseCache. There are actually three
separate caches:
| Modifier and Type | Class and Description |
|---|---|
protected class |
DatabaseCacheImpl.ChronicleCache
ChronicleCache is an LRU cache which requests removal of the least
recently accessed value when the capacity is exceeded.
|
| Constructor and Description |
|---|
DatabaseCacheImpl(Database db,
int capacity)
Construct a
DatabaseCache with a 0.75 load factor. |
DatabaseCacheImpl(Database db,
int capacity,
float loadFactor)
Construct a
DatabaseCache. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the cache.
|
void |
clear(Chronicle chronicle)
Remove a chronicle from the cache if present.
|
void |
clear(Property<?> property)
Remove a property from the cache if present.
|
void |
clear(Schema schema)
Remove a schema from the cache if present.
|
void |
clear(ValueType<?> valueType)
Remove a value type from the cache if present.
|
ChronicleImpl |
lookUpChronicle(String name)
Look up a chronicle in the cache by name.
|
ChronicleImpl |
lookUpChronicle(Surrogate surrogate)
Look up a chronicle in the cache.
|
Property<?> |
lookUpProperty(String name)
Look up a property in the cache by name.
|
void |
setMessageListener(MessageListener messageListener)
Set a message listener.
|
int |
size()
Return the number of chronicles currently in the cache.
|
ChronicleImpl |
store(ChronicleImpl entity)
Store a chronicle in the cache and return a copy.
|
public DatabaseCacheImpl(Database db, int capacity, float loadFactor)
DatabaseCache.db - the database being cachedcapacity - a positive numberloadFactor - a number between 0 and 1public DatabaseCacheImpl(Database db, int capacity)
DatabaseCache with a 0.75 load factor.db - the database being cachedcapacity - a positive numberpublic void setMessageListener(MessageListener messageListener)
messageListener - a message listenerpublic ChronicleImpl lookUpChronicle(Surrogate surrogate)
DatabaseCachelookUpChronicle in interface DatabaseCachesurrogate - a chronicle surrogatepublic ChronicleImpl lookUpChronicle(String name)
DatabaseCachelookUpChronicle in interface DatabaseCachename - a stringpublic Property<?> lookUpProperty(String name) throws T2DBException
DatabaseCachelookUpProperty in interface DatabaseCachename - a stringT2DBExceptionpublic ChronicleImpl store(ChronicleImpl entity) throws T2DBException
DatabaseCachestore in interface DatabaseCacheentity - a chronicleT2DBExceptionpublic int size()
DatabaseCachesize in interface DatabaseCachepublic void clear()
DatabaseCacheclear in interface DatabaseCachepublic void clear(Chronicle chronicle)
DatabaseCacheclear in interface DatabaseCachechronicle - a chroniclepublic void clear(Schema schema)
DatabaseCacheclear in interface DatabaseCacheschema - a schemapublic void clear(Property<?> property)
DatabaseCacheclear in interface DatabaseCacheproperty - a propertypublic void clear(ValueType<?> valueType)
DatabaseCacheclear in interface DatabaseCachevalueType - a valueTypeCopyright © 2017. All rights reserved.