Package io.mangoo.cache
Class CacheImpl
- java.lang.Object
-
- io.mangoo.cache.CacheImpl
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the complete cache by invalidating all entries<T> Tget(String key)Retrieves an object from the caches and converts it to a given classAtomicIntegergetAndDecrementCounter(String key)Decrements a counter with a given key If the counter does not exists, it will be created and the decrementedAtomicIntegergetAndIncrementCounter(String key)Increments a cache counter with a given key If the counter does not exists, it will be created and the incrementedAtomicIntegergetCounter(String key)Retrieves the counter for a given keyvoidput(String key, Object value)Adds a value to cache with a given key overwriting and existing valuevoidputAll(Map<String,Object> map)Adds a complete map of objects to the cachevoidremove(String key)Removes a value with a given key from the cacheAtomicIntegerresetCounter(String key)Resets the counter for a given key
-
-
-
Method Detail
-
put
public void put(String key, Object value)
Description copied from interface:CacheAdds a value to cache with a given key overwriting and existing value
-
remove
public void remove(String key)
Description copied from interface:CacheRemoves a value with a given key from the cache
-
clear
public void clear()
Description copied from interface:CacheClears the complete cache by invalidating all entries
-
get
public <T> T get(String key)
Description copied from interface:CacheRetrieves an object from the caches and converts it to a given class
-
putAll
public void putAll(Map<String,Object> map)
Description copied from interface:CacheAdds a complete map of objects to the cache
-
getAndIncrementCounter
public AtomicInteger getAndIncrementCounter(String key)
Description copied from interface:CacheIncrements a cache counter with a given key If the counter does not exists, it will be created and the incremented- Specified by:
getAndIncrementCounterin interfaceCache- Parameters:
key- The key for the cached value- Returns:
- A counter based on AtomicInteger
-
getCounter
public AtomicInteger getCounter(String key)
Description copied from interface:CacheRetrieves the counter for a given key- Specified by:
getCounterin interfaceCache- Parameters:
key- The key for the counter- Returns:
- A counter based on AtomicInteger or null if none found
-
resetCounter
public AtomicInteger resetCounter(String key)
Description copied from interface:CacheResets the counter for a given key- Specified by:
resetCounterin interfaceCache- Parameters:
key- The key for the counter- Returns:
- A counter based on AtomicInteger
-
getAndDecrementCounter
public AtomicInteger getAndDecrementCounter(String key)
Description copied from interface:CacheDecrements a counter with a given key If the counter does not exists, it will be created and the decremented- Specified by:
getAndDecrementCounterin interfaceCache- Parameters:
key- The key for the cached value- Returns:
- A counter based on AtomicInteger
-
-