public class SimplCache<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SimplCache.CACHE_TYPES |
static class |
SimplCache.EVICTION_TYPES |
static class |
SimplCache.MEMORY_TYPES |
static class |
SimplCache.POLICY_CONTROL |
static class |
SimplCache.SimplCacheBuilder<T> |
static class |
SimplCache.WRITE_BACK_TYPE |
static class |
SimplCache.WRITEBACKPARAMETER |
| Modifier and Type | Method and Description |
|---|---|
static <T> SimplCache<T> |
buildFromSaveState(String saveStateString,
CacheDB<T> cacheDB,
PersistentDB<T> persistentDB)
This method is used to build the SimplCache object from the string returned by the save state function.
|
static <T> SimplCache<T> |
buildFromSaveState(String saveStateString,
CacheDB<T> cacheDB,
PersistentDB<T> persistentDB,
SimplCacheEncryptor simplCacheEncryptor)
This method is used to build the SimplCache object from the string returned by the save state function.
|
void |
close(SimplCache.WRITEBACKPARAMETER writebackparameter)
This method is used to close all the threads started by the SimplCache object.
|
void |
flush(SimplCache.WRITEBACKPARAMETER writebackparameter)
This method is used to empty the cache.
|
T |
get(String key)
This method is used fetch the cache object from cache.
|
SimplCache.MEMORY_TYPES |
getCacheMemoryType()
This methods return the type of cache memory is used to maintain the cache.
|
Long |
getCacheSize()
This method return the maximum cache memory size set to the simplcache object.
|
Long |
getCacheTimeLimit()
This method return the time limit set on each cache item when the time eviction policy is enabled.
|
SimplCache.CACHE_TYPES |
getCacheType()
This method return the type of cache set to the simplcache object
|
Long |
getCurrentCacheSize()
This method return the current size of the cache.
|
SimplCache.EVICTION_TYPES |
getEvictionType()
This method return the type of eviction policy set to the simplcache object
|
void |
put(String key,
T object)
This method is used to put the object in cache according to the cache type and eviction policies.
|
void |
put(String key,
T object,
SimplCache.POLICY_CONTROL policy_control)
This method is used to put the object in cache and also into the persistentDB according to the cache type and eviction policies.
|
String |
saveState()
This method is used to save the state of the keys present in the cache.
|
String |
saveState(SimplCacheEncryptor simplCacheEncryptor)
This method is used to save the state of the keys present in the cache.
|
void |
writeBack()
This method is used to write the cache items into persistentDB whenever required.
|
public SimplCache.CACHE_TYPES getCacheType()
SimplCache.CACHE_TYPESpublic SimplCache.EVICTION_TYPES getEvictionType()
SimplCache.EVICTION_TYPESpublic SimplCache.MEMORY_TYPES getCacheMemoryType()
SimplCache.MEMORY_TYPESpublic Long getCacheSize()
public Long getCurrentCacheSize()
public Long getCacheTimeLimit()
public static <T> SimplCache<T> buildFromSaveState(String saveStateString, CacheDB<T> cacheDB, PersistentDB<T> persistentDB)
T - saveStateString - cacheDB - persistentDB - public static <T> SimplCache<T> buildFromSaveState(String saveStateString, CacheDB<T> cacheDB, PersistentDB<T> persistentDB, SimplCacheEncryptor simplCacheEncryptor)
T - saveStateString - cacheDB - persistentDB - SimplCacheEncryptorpublic void put(String key, T object)
key - object - public void put(String key, T object, SimplCache.POLICY_CONTROL policy_control)
key - object - policy_control - public T get(String key) throws Exception
key - Exceptionpublic void writeBack()
public void flush(SimplCache.WRITEBACKPARAMETER writebackparameter)
writebackparameter - SimplCache.WRITEBACKPARAMETERpublic void close(SimplCache.WRITEBACKPARAMETER writebackparameter)
writebackparameter - SimplCache.WRITEBACKPARAMETERpublic String saveState()
is used to build the state of cache back.public String saveState(SimplCacheEncryptor simplCacheEncryptor)
Copyright © 2020. All rights reserved.