Interface Cache<K,​V>

Type Parameters:
K - the key type
V - the value type
All Superinterfaces:
AutoCloseable, javax.cache.Cache<K,​V>, Closeable, Iterable<javax.cache.Cache.Entry<K,​V>>, Unwrappable
All Known Implementing Classes:
Cache.Default

public interface Cache<K,​V>
extends javax.cache.Cache<K,​V>, Unwrappable
JSR-107 compliant Cache.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Interface Description
    static class  Cache.Default<K,​V>  

    Nested classes/interfaces inherited from interface javax.cache.Cache

    javax.cache.Cache.Entry<K extends Object,​V extends Object>

    Nested classes/interfaces inherited from interface one.microstream.cache.Unwrappable

    Unwrappable.Static
  • Method Summary

    Modifier and Type Method Description
    void evict​(Iterable<KeyValue<Object,​CachedValue>> entriesToEvict)
    Evicts given entries from this cache.
    CacheManager getCacheManager()  
    CacheConfiguration<K,​V> getConfiguration()
    Returns the CacheConfiguration which was used to create this cache.
    static <K,​ V> Cache<K,​V> New​(String name, CacheManager manager, CacheConfiguration<K,​V> configuration)  
    default void putAll​(Map<? extends K,​? extends V> map)
    Adds all entries to this cache.
    default void putAll​(Map<? extends K,​? extends V> map, boolean replaceExistingValues)
    Adds all entries to this cache.
    void putAll​(Map<? extends K,​? extends V> map, boolean replaceExistingValues, boolean useWriteThrough)
    Adds all entries to this cache.
    void setManagementEnabled​(boolean enabled)
    Enables or disables the management bean of this cache.
    void setStatisticsEnabled​(boolean enabled)
    Enables or disables statistics gathering.
    long size()
    Returns the amount of entries in this cache.
    default <T> T unwrap​(Class<T> clazz)  

    Methods inherited from interface javax.cache.Cache

    clear, close, containsKey, deregisterCacheEntryListener, get, getAll, getAndPut, getAndRemove, getAndReplace, getConfiguration, getName, invoke, invokeAll, isClosed, iterator, loadAll, put, putIfAbsent, registerCacheEntryListener, remove, remove, removeAll, removeAll, replace, replace

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • getCacheManager

      CacheManager getCacheManager()
      Specified by:
      getCacheManager in interface javax.cache.Cache<K,​V>
    • getConfiguration

      CacheConfiguration<K,​V> getConfiguration()
      Returns the CacheConfiguration which was used to create this cache.
    • size

      long size()
      Returns the amount of entries in this cache.
      Returns:
      this cache's size
    • putAll

      default void putAll​(Map<? extends K,​? extends V> map)
      Adds all entries to this cache.

      Short for putAll(map, true)

      Specified by:
      putAll in interface javax.cache.Cache<K,​V>
      See Also:
      putAll(Map,boolean)
    • putAll

      default void putAll​(Map<? extends K,​? extends V> map, boolean replaceExistingValues)
      Adds all entries to this cache.

      Short for putAll(map, replaceExistingValues, true)

      See Also:
      putAll(Map,boolean,boolean)
    • putAll

      void putAll​(Map<? extends K,​? extends V> map, boolean replaceExistingValues, boolean useWriteThrough)
      Adds all entries to this cache.
      Parameters:
      map - entries to add
      replaceExistingValues - if values with same keys should be replaces
      useWriteThrough - enable write through mode for this operation
    • setManagementEnabled

      void setManagementEnabled​(boolean enabled)
      Enables or disables the management bean of this cache.
    • setStatisticsEnabled

      void setStatisticsEnabled​(boolean enabled)
      Enables or disables statistics gathering.
    • evict

      void evict​(Iterable<KeyValue<Object,​CachedValue>> entriesToEvict)
      Evicts given entries from this cache.
    • unwrap

      default <T> T unwrap​(Class<T> clazz)
      Specified by:
      unwrap in interface javax.cache.Cache<K,​V>
      Specified by:
      unwrap in interface Unwrappable
    • New

      static <K,​ V> Cache<K,​V> New​(String name, CacheManager manager, CacheConfiguration<K,​V> configuration)