Class CacheImpl

  • All Implemented Interfaces:
    Cache

    public class CacheImpl
    extends Object
    implements Cache
    Author:
    svenkubiak
    • Constructor Detail

      • CacheImpl

        public CacheImpl​(org.ehcache.Cache<String,​Object> ehCache)
    • Method Detail

      • put

        public void put​(String key,
                        Object value)
        Description copied from interface: Cache
        Adds a value to cache with a given key overwriting and existing value
        Specified by:
        put in interface Cache
        Parameters:
        key - The key for the cached value
        value - The value to store
      • remove

        public void remove​(String key)
        Description copied from interface: Cache
        Removes a value with a given key from the cache
        Specified by:
        remove in interface Cache
        Parameters:
        key - The key for the cached value
      • clear

        public void clear()
        Description copied from interface: Cache
        Clears the complete cache by invalidating all entries
        Specified by:
        clear in interface Cache
      • get

        public <T> T get​(String key)
        Description copied from interface: Cache
        Retrieves an object from the caches and converts it to a given class
        Specified by:
        get in interface Cache
        Type Parameters:
        T - JavaDoc requires this (just ignore it)
        Parameters:
        key - The key for the cached value
        Returns:
        A converted cache class value
      • putAll

        public void putAll​(Map<String,​Object> map)
        Description copied from interface: Cache
        Adds a complete map of objects to the cache
        Specified by:
        putAll in interface Cache
        Parameters:
        map - The map to add
      • getAndIncrementCounter

        public AtomicInteger getAndIncrementCounter​(String key)
        Description copied from interface: Cache
        Increments a cache counter with a given key If the counter does not exists, it will be created and the incremented
        Specified by:
        getAndIncrementCounter in interface Cache
        Parameters:
        key - The key for the cached value
        Returns:
        A counter based on AtomicInteger
      • getCounter

        public AtomicInteger getCounter​(String key)
        Description copied from interface: Cache
        Retrieves the counter for a given key
        Specified by:
        getCounter in interface Cache
        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: Cache
        Resets the counter for a given key
        Specified by:
        resetCounter in interface Cache
        Parameters:
        key - The key for the counter
        Returns:
        A counter based on AtomicInteger
      • getAndDecrementCounter

        public AtomicInteger getAndDecrementCounter​(String key)
        Description copied from interface: Cache
        Decrements a counter with a given key If the counter does not exists, it will be created and the decremented
        Specified by:
        getAndDecrementCounter in interface Cache
        Parameters:
        key - The key for the cached value
        Returns:
        A counter based on AtomicInteger