public class CacheManager extends Object
getInstance() method.| Modifier | Constructor and Description |
|---|---|
protected |
CacheManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToCache(String cacheName,
Object key,
CacheObject value)
Adds item to a cache.
|
boolean |
cacheExists(String cacheName)
Checks if cache exitsts
|
void |
cleanup()
This method should be invoked to clear up resources from memory
|
void |
clearCache(String cacheName) |
void |
createNewCache(String cacheName,
int maxItems)
Creates a new cache in the cache manager.
|
boolean |
existsInCache(String cacheName,
Object key)
Checks if a particular object exists in a cache
|
CacheObject |
getFromCache(String cacheName,
Object key)
Fetches item from a cache and marks it as the most recently used.
|
static CacheManager |
getInstance()
Create or return a singleton instance of the CacheManager
|
public static CacheManager getInstance()
public void createNewCache(String cacheName, int maxItems)
cacheName - - Name given to the required cachemaxItems - - Max number of items stored in the cachepublic void addToCache(String cacheName, Object key, CacheObject value)
cacheName - - Cache identifier name to which item is being addedkey - - An identifiable key for the item addedvalue - - The cache object addedpublic CacheObject getFromCache(String cacheName, Object key)
cacheName - - Cache identifier name to which item is being fetchedkey - - The identifiable keypublic boolean cacheExists(String cacheName)
cacheName - public boolean existsInCache(String cacheName, Object key)
cacheName - - Cache identifier name to which item is being fetchedkey - - The identifiable keypublic void cleanup()
public void clearCache(String cacheName)
Copyright © 2017 Enterprise Information Systems - University of Bonn. All rights reserved.