Interface CacheStore<K,​V>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void erase​(K key)
      Remove the specified key from the underlying store if present.
      default void eraseAll​(Collection<? extends K> colKeys)
      Remove the specified keys from the underlying store if present.
      void store​(K key, V value)
      Store the specified value under the specified key in the underlying store.
      default void storeAll​(Map<? extends K,​? extends V> mapEntries)
      Store the specified values under the specified keys in the underlying store.
    • Method Detail

      • store

        void store​(K key,
                   V value)
        Store the specified value under the specified key in the underlying store. This method is intended to support both key/value creation and value update for a specific key.
        Parameters:
        key - key to store the value under
        value - value to be stored
        Throws:
        UnsupportedOperationException - if this implementation or the underlying store is read-only
      • storeAll

        default void storeAll​(Map<? extends K,​? extends V> mapEntries)
        Store the specified values under the specified keys in the underlying store. This method is intended to support both key/value creation and value update for the specified keys.

        If this operation fails (by throwing an exception) after a partial success, the convention is that entries which have been stored successfully are to be removed from the specified mapEntries, indicating that the store operation for the entries left in the map has failed or has not been attempted.

        The default implementation of this method calls store(K, V) for each entry in the supplied Map. Once stored successfully, an entry is removed from the Map (if possible). Implementations that can optimize multi-entry operations should override this default implementation.

        Parameters:
        mapEntries - a Map of any number of keys and values to store
        Throws:
        UnsupportedOperationException - if this implementation or the underlying store is read-only
      • erase

        void erase​(K key)
        Remove the specified key from the underlying store if present.
        Parameters:
        key - key whose mapping is being removed from the cache
        Throws:
        UnsupportedOperationException - if this implementation or the underlying store is read-only
      • eraseAll

        default void eraseAll​(Collection<? extends K> colKeys)
        Remove the specified keys from the underlying store if present.

        If this operation fails (by throwing an exception) after a partial success, the convention is that keys which have been erased successfully are to be removed from the specified colKeys, indicating that the erase operation for the keys left in the collection has failed or has not been attempted.

        The default implementation of this method calls erase(K) for each key in the supplied Collection. Once erased successfully, the key is removed from the Collection (if possible). Implementations that can optimize multi-key operations should override this default implementation.

        Parameters:
        colKeys - keys whose mappings are being removed from the cache
        Throws:
        UnsupportedOperationException - if this implementation or the underlying store is read-only