Class SimpleCacheProvider
- java.lang.Object
-
- com.deviceatlas.cloud.deviceidentification.cacheprovider.SimpleCacheProvider
-
- All Implemented Interfaces:
CacheProvider
public class SimpleCacheProvider extends java.lang.Object implements CacheProvider
Map cache provider. The data is cached in memory inside a HashMap.
-
-
Constructor Summary
Constructors Constructor Description SimpleCacheProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Entirely clear the cache content<T> T
get(java.lang.String key)
Getting an entry on the cachejava.util.List<java.lang.String>
getKeys()
Returns all keys from a given cachevoid
remove(java.lang.String key)
Removes an entry in the cache<T> void
set(java.lang.String key, T entry)
Adding an entry to the cachevoid
setExpiry(int expiry)
Reconfigure the expiry aftervoid
shutdown()
Shutdown the general cache framework
-
-
-
Method Detail
-
get
public <T> T get(java.lang.String key) throws CacheException
Description copied from interface:CacheProvider
Getting an entry on the cache- Specified by:
get
in interfaceCacheProvider
- Type Parameters:
T
- cache entry- Parameters:
key
- key of the cache entry- Returns:
- Object
- Throws:
CacheException
- when there is cache issues getting by key
-
set
public <T> void set(java.lang.String key, T entry) throws CacheException
Description copied from interface:CacheProvider
Adding an entry to the cache- Specified by:
set
in interfaceCacheProvider
- Type Parameters:
T
- cache entry- Parameters:
key
- key of the cache entryentry
- cache entry- Throws:
CacheException
- when there is cache issues setting an element
-
remove
public void remove(java.lang.String key) throws CacheException
Description copied from interface:CacheProvider
Removes an entry in the cache- Specified by:
remove
in interfaceCacheProvider
- Parameters:
key
- key of the cache entry- Throws:
CacheException
- when there is cache issues removing an entry
-
clear
public void clear()
Description copied from interface:CacheProvider
Entirely clear the cache content- Specified by:
clear
in interfaceCacheProvider
-
shutdown
public void shutdown()
Description copied from interface:CacheProvider
Shutdown the general cache framework- Specified by:
shutdown
in interfaceCacheProvider
-
getKeys
public java.util.List<java.lang.String> getKeys()
Description copied from interface:CacheProvider
Returns all keys from a given cache- Specified by:
getKeys
in interfaceCacheProvider
- Returns:
- List
-
setExpiry
public void setExpiry(int expiry)
Description copied from interface:CacheProvider
Reconfigure the expiry after- Specified by:
setExpiry
in interfaceCacheProvider
- Parameters:
expiry
- cache time life in minutes
-
-