Class Caffeine.CacheWriterAdapter<K,​V>

  • All Implemented Interfaces:
    CacheWriter<K,​V>, java.io.Serializable
    Enclosing class:
    Caffeine<K,​V>

    static final class Caffeine.CacheWriterAdapter<K,​V>
    extends java.lang.Object
    implements CacheWriter<K,​V>, java.io.Serializable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(K key, @Nullable V value, RemovalCause cause)
      Deletes the value corresponding to the key from the external resource.
      void write​(K key, V value)
      Writes the value corresponding to the key to the external resource.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CacheWriterAdapter

        CacheWriterAdapter​(RemovalListener<? super K,​? super V> delegate,
                           boolean isAsync)
    • Method Detail

      • write

        public void write​(K key,
                          V value)
        Description copied from interface: CacheWriter
        Writes the value corresponding to the key to the external resource. The cache will communicate a write when an entry in the cache is created or modified, except when that was due to a load or computation.
        Specified by:
        write in interface CacheWriter<K,​V>
        Parameters:
        key - the non-null key whose value should be written
        value - the value associated with key that should be written
      • delete

        public void delete​(K key,
                           @Nullable V value,
                           RemovalCause cause)
        Description copied from interface: CacheWriter
        Deletes the value corresponding to the key from the external resource. The cache will communicate a delete when the entry is explicitly removed or evicted.
        Specified by:
        delete in interface CacheWriter<K,​V>
        Parameters:
        key - the non-null key whose value was removed
        value - the value associated with key, or null if collected
        cause - the reason for which the entry was removed