Class WiredCache<K,​V>

    • Constructor Detail

      • WiredCache

        public WiredCache()
    • Method Detail

      • getHeapCache

        public HeapCache getHeapCache()
        For testing
      • getClock

        public org.cache2k.operation.TimeReference getClock()
        Description copied from interface: InternalCache
        Time reference for the cache.
        Specified by:
        getClock in interface InternalCache<K,​V>
      • getKeyType

        public org.cache2k.config.CacheType getKeyType()
        Specified by:
        getKeyType in interface InternalCache<K,​V>
      • computeIfAbsent

        public V computeIfAbsent​(K key,
                                 Function<? super K,​? extends V> function)
        Specified by:
        computeIfAbsent in interface org.cache2k.Cache<K,​V>
      • peekAndPut

        public V peekAndPut​(K key,
                            V value)
        Specified by:
        peekAndPut in interface org.cache2k.Cache<K,​V>
      • peekAndRemove

        public V peekAndRemove​(K key)
        Specified by:
        peekAndRemove in interface org.cache2k.Cache<K,​V>
      • peekAndReplace

        public V peekAndReplace​(K key,
                                V value)
        Specified by:
        peekAndReplace in interface org.cache2k.Cache<K,​V>
      • peekEntry

        public org.cache2k.CacheEntry<K,​V> peekEntry​(K key)
        Specified by:
        peekEntry in interface org.cache2k.Cache<K,​V>
      • containsKey

        public boolean containsKey​(K key)
        Specified by:
        containsKey in interface org.cache2k.Cache<K,​V>
      • putIfAbsent

        public boolean putIfAbsent​(K key,
                                   V value)
        Specified by:
        putIfAbsent in interface org.cache2k.Cache<K,​V>
      • put

        public void put​(K key,
                        V value)
        Specified by:
        put in interface org.cache2k.Cache<K,​V>
      • putAll

        public void putAll​(Map<? extends K,​? extends V> m)
        Specified by:
        putAll in interface org.cache2k.Cache<K,​V>
      • remove

        public void remove​(K key)
        Specified by:
        remove in interface org.cache2k.Cache<K,​V>
      • removeIfEquals

        public boolean removeIfEquals​(K key,
                                      V value)
        Specified by:
        removeIfEquals in interface org.cache2k.Cache<K,​V>
      • containsAndRemove

        public boolean containsAndRemove​(K key)
        Specified by:
        containsAndRemove in interface org.cache2k.Cache<K,​V>
      • replace

        public boolean replace​(K key,
                               V newValue)
        Specified by:
        replace in interface org.cache2k.Cache<K,​V>
      • replaceIfEquals

        public boolean replaceIfEquals​(K key,
                                       V oldValue,
                                       V newValue)
        Specified by:
        replaceIfEquals in interface org.cache2k.Cache<K,​V>
      • get

        public V get​(K key)
        Specified by:
        get in interface org.cache2k.Cache<K,​V>
        Specified by:
        get in interface org.cache2k.KeyValueSource<K,​V>
      • getAll

        public Map<K,​V> getAll​(Iterable<? extends K> requestedKeys)
        This takes four different execution paths depending on cache setup and state: no loader and/or all data present in heap, async or async bulk, parallel single load, bulk load.
        Specified by:
        getAll in interface org.cache2k.Cache<K,​V>
      • getEntry

        public org.cache2k.CacheEntry<K,​V> getEntry​(K key)
        Specified by:
        getEntry in interface org.cache2k.Cache<K,​V>
      • invokeAll

        public <@Nullable R> Map<K,​org.cache2k.processor.EntryProcessingResult<R>> invokeAll​(Iterable<? extends K> keys,
                                                                                                   org.cache2k.processor.EntryProcessor<K,​V,​@Nullable R> entryProcessor)
        Specified by:
        invokeAll in interface org.cache2k.Cache<K,​V>
        Overrides:
        invokeAll in class BaseCache<K,​V>
      • peek

        public V peek​(K key)
        Specified by:
        peek in interface org.cache2k.Cache<K,​V>
      • peekAll

        public Map<K,​V> peekAll​(Iterable<? extends K> keys)
        We need to deal with possible null values and exceptions. This is a simple placeholder implementation that covers it all by working on the entry.
        Specified by:
        peekAll in interface org.cache2k.Cache<K,​V>
      • getConsistentInfo

        public InternalCacheInfo getConsistentInfo()
        Description copied from interface: InternalCache
        Generate fresh statistics within a global cache lock. This version is used by internal consistency tests. This method is not intended to be called at high frequencies or for attaching monitoring or logging. Use the InternalCache.getInfo() method for requesting information for monitoring.
        Specified by:
        getConsistentInfo in interface InternalCache<K,​V>
      • getInfo

        public InternalCacheInfo getInfo()
        Description copied from interface: InternalCache
        Return cache statistic counters. This method is intended for regular statistics polling. No extensive locking is performed to extract a consistent set of counters.
        Specified by:
        getInfo in interface InternalCache<K,​V>
      • checkIntegrity

        public void checkIntegrity()
        Description copied from interface: InternalCache
        Cache checks its internal integrity. This is a expansive operation because it may traverse all cache entries. Used for testing.
        Specified by:
        checkIntegrity in interface InternalCache<K,​V>
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface org.cache2k.Cache<K,​V>
      • init

        public void init()
      • clear

        public void clear()
        Specified by:
        clear in interface org.cache2k.Cache<K,​V>
      • close

        public void close()
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface org.cache2k.Cache<K,​V>
      • getUserCache

        public org.cache2k.Cache<K,​V> getUserCache()
        Description copied from interface: InternalCache
        Cache used by user, eventually wrapped. Only available in WiredCache for event processing.
        Specified by:
        getUserCache in interface InternalCache<K,​V>