Interface Cache<K,​V>

  • All Known Implementing Classes:
    InfinispanCache

    public interface Cache<K,​V>
    Abstraction over cache providers
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Removes all the keys and their values from the Cache
      V get​(K key)
      Retrieves the value for the given Key
      String getName()
      Name of the cache node
      boolean isTransactional()
      If the cache is transactional
      Set<K> keySet()
      Return all the keys
      V put​(K key, V value, Long ttl)
      Associates the specified value with the specified key this cache.
      V remove​(K key)
      Removes the value for this key from a Cache.
      int size()
      Size of the cache
    • Method Detail

      • get

        V get​(K key)
        Retrieves the value for the given Key
        Parameters:
        key - key under which value is to be retrieved.
        Returns:
        returns data held under specified key in cache
      • put

        V put​(K key,
              V value,
              Long ttl)
        Associates the specified value with the specified key this cache. If the cache previously contained a mapping for this key, the old value is replaced by the specified value.
        Parameters:
        key - key with which the specified value is to be associated.
        value - value to be associated with the specified key.
        ttl - the time for this entry to live
        Returns:
        previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the key previously associated null with the specified key, if the implementation supports null values.
      • remove

        V remove​(K key)
        Removes the value for this key from a Cache. Returns the value to which the Key previously associated , or null if the Key contained no mapping.
        Parameters:
        key - key whose mapping is to be removed
        Returns:
        previous value associated with specified Node's key
      • size

        int size()
        Size of the cache
        Returns:
        number of items in this cache
      • clear

        void clear()
        Removes all the keys and their values from the Cache
      • getName

        String getName()
        Name of the cache node
        Returns:
      • keySet

        Set<K> keySet()
        Return all the keys
        Returns:
      • isTransactional

        boolean isTransactional()
        If the cache is transactional
        Returns: