Package com.killcoding.cache
Class Cache
java.lang.Object
com.killcoding.cache.Cache
This class is Cache entry
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static AbsCacheApiDefault is use mode 'MemoryCache'private static final Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectGet a cache valuegetNames()Get all cache key name liststatic booleanCheck is included cache keystatic voidRemove a cachestatic voidRemove all cachestatic voidSet a cachestatic voidsetApi(AbsCacheApi _api) Set cache modestatic voidsetTimer(long timer) Set detect cache timer (Default is 100MS)
-
Field Details
-
api
Default is use mode 'MemoryCache' -
log
-
-
Constructor Details
-
Cache
public Cache()
-
-
Method Details
-
setApi
Set cache mode- Parameters:
_api- - It is class 'MemoryCache' or 'DiskCache'
-
setTimer
Set detect cache timer (Default is 100MS)- Parameters:
timer- - It is detect cache timer
-
set
Set a cache- Parameters:
name- - It is cache key namevalue- - It is cache valuelife- - It is life length seconds
-
get
Get a cache value- Parameters:
name- - It is cache key name- Returns:
- Object - It is cache value
-
included
Check is included cache key- Parameters:
name- - It is cache key name- Returns:
- boolean - 'true' is included, 'false' is not included.
-
remove
Remove a cache- Parameters:
name- - It is cache key name
-
removeAll
Remove all cache -
getNames
Get all cache key name list- Returns:
- List
- It is key name list
-