Interface CacheWarmer.WarmingEventHandler<K,V>

Type Parameters:
K - the key type | 键类型
V - the value type | 值类型
Enclosing class:
CacheWarmer<K,V>

public static interface CacheWarmer.WarmingEventHandler<K,V>
Warming event handler 预热事件处理器
Since:
JDK 25, opencode-base-cache V2.0.5
Author:
Leon Soo www.LeonSoo.com
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a no-op event handler | 返回空操作事件处理器
    default void
    Called when warming completes | 预热完成时调用
    default void
    onKeyFailed(K key, Exception error)
    Called when a key fails to warm | 键预热失败时调用
    default void
    onKeyWarmed(K key, V value)
    Called when a key is warmed | 键预热完成时调用
    default void
    onStart(int totalKeys)
    Called when warming starts | 预热开始时调用
  • Method Details

    • onStart

      default void onStart(int totalKeys)
      Called when warming starts | 预热开始时调用
      Parameters:
      totalKeys - total keys to warm | 要预热的总键数
    • onKeyWarmed

      default void onKeyWarmed(K key, V value)
      Called when a key is warmed | 键预热完成时调用
      Parameters:
      key - the key | 键
      value - the loaded value | 加载的值
    • onKeyFailed

      default void onKeyFailed(K key, Exception error)
      Called when a key fails to warm | 键预热失败时调用
      Parameters:
      key - the key | 键
      error - the error | 错误
    • onComplete

      default void onComplete(CacheWarmer.WarmingResult<K> result)
      Called when warming completes | 预热完成时调用
      Parameters:
      result - the warming result | 预热结果
    • noOp

      static <K,V> CacheWarmer.WarmingEventHandler<K,V> noOp()
      Returns a no-op event handler | 返回空操作事件处理器
      Type Parameters:
      K - the key type | 键类型
      V - the value type | 值类型
      Returns:
      no-op handler | 空操作处理器