Class ManagedCache<K,V>
java.lang.Object
io.leandev.appfuse.cache.core.ManagedCache<K,V>
- Type Parameters:
K- 鍵的型別V- 值的型別
- All Implemented Interfaces:
Cache<K,V>
-
Constructor Summary
ConstructorsConstructorDescriptionManagedCache(Cache<K, V> delegate, CacheConfiguration<K, V> configuration) 以獨立旗標建構(standalone 用途,如單元測試)ManagedCache(Cache<K, V> delegate, CacheConfiguration<K, V> configuration, AtomicBoolean managerEnabled, AtomicBoolean cacheEnabled) 以共享旗標建構(由 CacheManager 使用) -
Method Summary
-
Constructor Details
-
ManagedCache
public ManagedCache(Cache<K, V> delegate, CacheConfiguration<K, V> configuration, AtomicBoolean managerEnabled, AtomicBoolean cacheEnabled) 以共享旗標建構(由 CacheManager 使用)- Parameters:
delegate- 底層快取configuration- 快取配置managerEnabled- manager 層總閘(共享旗標)cacheEnabled- 本快取個別開關(共享旗標)
-
ManagedCache
-
-
Method Details
-
get
-
put
-
remove
-
remove
Description copied from interface:Cache僅在目前值等於預期值時原子移除快取項目
安全狀態機(例如一次性 token)不可用
get後再remove,兩個請求可能同時讀到 同一筆資料。實作須把「比對 + 移除」交給同一個 backing store 的原子操作。 -
clear
-
containsKey
-
disable
-
enable
-
isEnabled
-
getStatistics
Description copied from interface:Cache取得快取統計資訊- Specified by:
getStatisticsin interfaceCache<K,V> - Returns:
- 統計資訊
-
getStatus
-
getName
-
getConfiguration
Description copied from interface:Cache取得快取配置- Specified by:
getConfigurationin interfaceCache<K,V> - Returns:
- 配置資訊
-
getDelegate
-