public static class SimplCache.SimplCacheBuilder<T> extends Object
| Constructor and Description |
|---|
SimplCacheBuilder(CacheDB<T> cacheDB,
PersistentDB<T> persistentDB)
This method is used to build the SimplCache object.
|
| Modifier and Type | Method and Description |
|---|---|
SimplCache<T> |
build()
This method builds and return SimplCache Object
|
SimplCache.SimplCacheBuilder<T> |
setCacheMemoryProperties(SimplCache.MEMORY_TYPES memory,
long cacheSize)
This method is used set the cache memory type.
|
SimplCache.SimplCacheBuilder<T> |
setCacheType(SimplCache.CACHE_TYPES cacheType)
This methode is used to set the type of cache.
|
SimplCache.SimplCacheBuilder<T> |
setEvictionPolicy(SimplCache.EVICTION_TYPES evictionPolicy)
This method is used to set the eviction policy
There are two types of policy:
LRU_EVICTION: Least recently used cache object is evicted
TIME_EVICTION: The cache object is evicted after given time limit.
|
SimplCache.SimplCacheBuilder<T> |
setTimeEvictionInterval(long duration,
TimeUnit timeUnit)
This method is used to set time interval after which cache object is evicted from the cache.
|
SimplCache.SimplCacheBuilder<T> |
setWriteBackInterval(long duration,
TimeUnit timeUnit)
This method is used to set the interval at which automated write back occurs.
|
String |
toString() |
public SimplCacheBuilder(CacheDB<T> cacheDB, PersistentDB<T> persistentDB)
cacheDB - persistentDB - CacheDB,
PersistentDBpublic SimplCache.SimplCacheBuilder<T> setCacheMemoryProperties(SimplCache.MEMORY_TYPES memory, long cacheSize)
memory - cacheSize - (object count or size in kilobytes)There are two memory types:
OBJECT_COUNT: Cache Size is maintained in terms of the number of objects in the cache.
OBJECT_SIZE: Cache Size is maintained in terms of the size of objects occupied in memory.public SimplCache.SimplCacheBuilder<T> setCacheType(SimplCache.CACHE_TYPES cacheType)
cacheType - SimplCache.CACHE_TYPESpublic SimplCache.SimplCacheBuilder<T> setWriteBackInterval(long duration, TimeUnit timeUnit)
duration - timeUnit - public SimplCache.SimplCacheBuilder<T> setEvictionPolicy(SimplCache.EVICTION_TYPES evictionPolicy)
evictionPolicy - SimplCache.EVICTION_TYPESpublic SimplCache.SimplCacheBuilder<T> setTimeEvictionInterval(long duration, TimeUnit timeUnit)
duration - timeUnit - public SimplCache<T> build()
Copyright © 2020. All rights reserved.