Class LruCacheController
java.lang.Object
com.ibatis.sqlmap.engine.cache.lru.LruCacheController
- All Implemented Interfaces:
CacheController
LRU (least recently used) cache controller implementation.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
flush
(CacheModel cacheModel) Flushes the cache.int
Gets the cache size.getObject
(CacheModel cacheModel, Object key) Get an object out of the cache.void
putObject
(CacheModel cacheModel, Object key, Object value) Add an object to the cacheremoveObject
(CacheModel cacheModel, Object key) Remove an object from a cache model.void
setCacheSize
(int cacheSize) Sets the cache size.void
setProperties
(Properties props) Configures the cache
-
Constructor Details
-
LruCacheController
public LruCacheController()Default constructor.
-
-
Method Details
-
getCacheSize
public int getCacheSize()Gets the cache size.- Returns:
- the cache size
-
setCacheSize
public void setCacheSize(int cacheSize) Sets the cache size.- Parameters:
cacheSize
- the new cache size
-
setProperties
Configures the cache- Specified by:
setProperties
in interfaceCacheController
- Parameters:
props
- Optionally can contain properties [reference-type=WEAK|SOFT|STRONG]
-
putObject
Add an object to the cache- Specified by:
putObject
in interfaceCacheController
- Parameters:
cacheModel
- The cacheModelkey
- The key of the object to be cachedvalue
- The object to be cached
-
getObject
Get an object out of the cache.- Specified by:
getObject
in interfaceCacheController
- Parameters:
cacheModel
- The cache modelkey
- The key of the object to be returned- Returns:
- The cached object (or null)
-
removeObject
Description copied from interface:CacheController
Remove an object from a cache model.- Specified by:
removeObject
in interfaceCacheController
- Parameters:
cacheModel
- - the model to remove the object fromkey
- - the key to the object- Returns:
- the removed object(?)
-
flush
Flushes the cache.- Specified by:
flush
in interfaceCacheController
- Parameters:
cacheModel
- The cache model
-