Interface WriteThroughCache.CacheWriter<K,V>

Type Parameters:
K - key type | 键类型
V - value type | 值类型
Enclosing class:
WriteThroughCache<K,V>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface WriteThroughCache.CacheWriter<K,V>
Cache Writer - Writes cache entries to backend storage 缓存写入器 - 将缓存条目写入后端存储
Since:
JDK 25, opencode-base-cache V2.0.4
Author:
Leon Soo www.LeonSoo.com
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    write(K key, V value)
    Write a single entry to backend 写入单个条目到后端
    default void
    writeAll(Map<? extends K, ? extends V> entries)
    Write multiple entries to backend (default: write one by one) 写入多个条目到后端(默认:逐个写入)
  • Method Details

    • write

      void write(K key, V value) throws Exception
      Write a single entry to backend 写入单个条目到后端
      Parameters:
      key - the key | 键
      value - the value | 值
      Throws:
      Exception - if write fails | 写入失败时抛出异常
    • writeAll

      default void writeAll(Map<? extends K, ? extends V> entries) throws Exception
      Write multiple entries to backend (default: write one by one) 写入多个条目到后端(默认:逐个写入)
      Parameters:
      entries - the entries | 条目集合
      Throws:
      Exception - if write fails | 写入失败时抛出异常