Interface Cache

  • All Known Implementing Classes:
    CacheImpl

    public interface Cache
    Author:
    svenkubiak
    • Method Detail

      • put

        void put​(String key,
                 Object value)
        Adds a value to cache with a given key overwriting and existing value
        Parameters:
        key - The key for the cached value
        value - The value to store
      • remove

        void remove​(String key)
        Removes a value with a given key from the cache
        Parameters:
        key - The key for the cached value
      • clear

        void clear()
        Clears the complete cache by invalidating all entries
      • get

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

        void putAll​(Map<String,​Object> map)
        Adds a complete map of objects to the cache
        Parameters:
        map - The map to add
      • getAndIncrementCounter

        AtomicInteger getAndIncrementCounter​(String key)
        Increments a cache counter with a given key If the counter does not exists, it will be created and the incremented
        Parameters:
        key - The key for the cached value
        Returns:
        A counter based on AtomicInteger
      • getAndDecrementCounter

        AtomicInteger getAndDecrementCounter​(String key)
        Decrements a counter with a given key If the counter does not exists, it will be created and the decremented
        Parameters:
        key - The key for the cached value
        Returns:
        A counter based on AtomicInteger
      • getCounter

        AtomicInteger getCounter​(String key)
        Retrieves the counter for a given key
        Parameters:
        key - The key for the counter
        Returns:
        A counter based on AtomicInteger or null if none found
      • resetCounter

        AtomicInteger resetCounter​(String key)
        Resets the counter for a given key
        Parameters:
        key - The key for the counter
        Returns:
        A counter based on AtomicInteger