Package com.adobe.aemds.guide.cache
Class Cache
- java.lang.Object
-
- com.adobe.aemds.guide.cache.Cache
-
public class Cache extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Cache(CacheStore cacheStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(java.lang.String key)
Removes the value from the cache associated with the keyvoid
clearAll()
Clears all the entries in the cacheboolean
entryExists(java.lang.Object key)
Returns if a value is associated with the keyjava.lang.Object
get(java.lang.Object key)
Get an object from the cache.boolean
isCacheEntryStale(java.lang.Object key, java.util.Calendar updateTime)
Returns whether the object in the cache associated with the key is valid given the last update time of the keyjava.lang.Object
put(java.lang.Object key, java.lang.Object value, java.util.Calendar modifiedTime)
Put an object in the cache with a key that can be used to retrieve the object later.
-
-
-
Constructor Detail
-
Cache
public Cache(CacheStore cacheStore)
-
-
Method Detail
-
put
public java.lang.Object put(java.lang.Object key, java.lang.Object value, java.util.Calendar modifiedTime)
Put an object in the cache with a key that can be used to retrieve the object later. If the object already exists it will be replaced- Parameters:
key
- Key against which the value is stored in cachevalue
- value to store in the cache- Returns:
- Object previously associated with the key in the cache or null if modified time equals LONG.MAX_VALUE
-
get
public java.lang.Object get(java.lang.Object key)
Get an object from the cache. If not present null is returned- Parameters:
key
-- Returns:
-
clearAll
public void clearAll()
Clears all the entries in the cache
-
clear
public void clear(java.lang.String key)
Removes the value from the cache associated with the key- Parameters:
key
- key associated with the object that has to be removed
-
isCacheEntryStale
public boolean isCacheEntryStale(java.lang.Object key, java.util.Calendar updateTime)
Returns whether the object in the cache associated with the key is valid given the last update time of the key- Parameters:
key
- Key of the object whose validity has to be checkedupdateTime
- Calendar Instance of the update time of the- Returns:
- false if the entry is stale in the cache otherwise true. Also returns true, if key doesn't exist in Cache and false, if Calendar Instance is null
-
entryExists
public boolean entryExists(java.lang.Object key)
Returns if a value is associated with the key- Parameters:
key
-- Returns:
- true if a value is associated with the key false otherwise
-
-