|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.nutiteq.cache.MemoryCache
public class MemoryCache
Memory cache implementing LRU (least recently used) strategy. If cache is full, least recently used items will be pushed out.
Current implementation uses only actual data size. Objects/keys overhead is not calculated in cache size.
| Field Summary |
|---|
| Fields inherited from interface com.nutiteq.cache.Cache |
|---|
CACHE_LEVEL_MEMORY, CACHE_LEVEL_NONE, CACHE_LEVEL_PERSISTENT |
| Constructor Summary | |
|---|---|
MemoryCache(int cacheSize)
Create a new MemoryCache instance. |
|
| Method Summary | |
|---|---|
void |
cache(java.lang.String cacheId,
byte[] data,
int cacheLevel)
Cache given data |
boolean |
contains(java.lang.String cacheKey)
Does this cache contain data for given cache key |
boolean |
contains(java.lang.String cacheKey,
int cacheLevel)
Does the specified cache level contain given cache key |
void |
deinitialize()
Clean up cache resources and, if needed, write cache definition/index somewhere. |
byte[] |
get(java.lang.String cacheId)
Get cached data. |
void |
initialize()
Initialize needed resources for cache. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemoryCache(int cacheSize)
cacheSize - cache size in bytes.| Method Detail |
|---|
public void initialize()
Cache
initialize in interface Cachepublic void deinitialize()
Cache
deinitialize in interface Cachepublic byte[] get(java.lang.String cacheId)
Cache
get in interface CachecacheId - key that was used for data caching
public void cache(java.lang.String cacheId,
byte[] data,
int cacheLevel)
Cache
cache in interface CachecacheId - key for the cached datadata - data to be cachedcacheLevel - at which level this data needs to be cached (memory, rms, etc).public boolean contains(java.lang.String cacheKey)
Cache
contains in interface CachecacheKey - cache key checked
public boolean contains(java.lang.String cacheKey,
int cacheLevel)
Cache
contains in interface CachecacheKey - cache key to be checkedcacheLevel - which cache levels to check
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||