インタフェース CacheStore
- 既知の実装クラスのリスト:
FineGrainedLockIndexedConcurrentHashMapCacheStore,MapBaseCacheStore,NullCacheStore,RdbCacheStoreFactory.RdbCacheStore,SimpleCacheStoreBase,SimpleCacheStoreFactory.ConcurrentHashMapCacheStore,SimpleCacheStoreFactory.IndexedConcurrentHashMapCacheStore,SyncServerCacheStoreFactory.SyncServerCacheStore,TransactionLocalCacheStoreFactory.TransactionLocalCacheStore
public interface CacheStore
ローレベルのキャッシュ機能を実装するキャッシュストアのインタフェース。
-
メソッドの概要
修飾子とタイプメソッド説明voidaddCacheEventListenner(CacheEventListener listener) default CacheEntrycompute(Object key, BiFunction<Object, CacheEntry, CacheEntry> remappingFunction) ConcurrentMapが提供するcomputeと同等の機能性を提供するメソッド。default CacheEntrycomputeIfAbsent(Object key, Function<Object, CacheEntry> mappingFunction) ConcurrentMapが提供するcomputeIfAbsentと同等の機能性を提供するメソッド。default CacheEntrycomputeIfAbsentWithAutoReload(Object key, BiFunction<Object, CacheEntry, CacheEntry> reloadFunction) 自動リロードするキャッシュエントリをputする。voiddestroy()getByIndex(int indexKey, Object indexValue) getListByIndex(int indexKey, Object indexValue) intgetSize()keySet()put(CacheEntry entry, boolean clean) putIfAbsent(CacheEntry entry) booleanremove(CacheEntry entry) voidremoveByIndex(int indexKey, Object indexValue) voidremoveCacheEventListenner(CacheEventListener listener) replace(CacheEntry entry) booleanreplace(CacheEntry oldEntry, CacheEntry newEntry) trace()
-
メソッドの詳細
-
getNamespace
String getNamespace() -
getFactory
CacheStoreFactory getFactory() -
getSize
int getSize() -
computeIfAbsentWithAutoReload
default CacheEntry computeIfAbsentWithAutoReload(Object key, BiFunction<Object, CacheEntry, CacheEntry> reloadFunction) 自動リロードするキャッシュエントリをputする。 まだkeyに紐づいたエントリがない場合にreloadFunctionによって取得されたエントリをputする。 既にkeyに紐づいたエントリがある場合はそのエントリを返却する。 reloadFunctionが返却するキャッシュエントリのtimeToLiveの時間経過後reloadFunctionを利用してCacheEntryを再取得する。 リロードは非同期で実行され、リロード完了するまでの間は古いCacheEntryを返す。 デフォルト実装では、JVMローカルでのみリロードされる。 リロード対象のキャッシュエントリが他の更新系メソッド(put, remove, replace)により更新された場合、リロードはキャンセルされる。- パラメータ:
key- キャッシュエントリのキーreloadFunction- キャッシュエントリが存在しない場合、リロード時に呼び出される関数。初回のロード時はapplyの引数CacheEntryはnullが渡される。また、リロード時はreloadFunctionは非同期にユーザ未特定で特権状態で実行される。- 戻り値:
- 初回ロード、もしくはリロードされたキャッシュエントリ
-
computeIfAbsent
ConcurrentMapが提供するcomputeIfAbsentと同等の機能性を提供するメソッド。 デフォルト実装ではmappingFunctionが複数回呼び出される可能性はある。 厳密にmappingFunctionが1度しか呼び出されないか否かは各CacheStore実装クラスによる。- パラメータ:
key-mappingFunction-- 戻り値:
-
compute
ConcurrentMapが提供するcomputeと同等の機能性を提供するメソッド。 デフォルト実装ではremappingFunctionが複数回呼び出される可能性はある。 厳密にremappingFunctionが1度しか呼び出されないか否かは各CacheStore実装クラスによる。- パラメータ:
key-remappingFunction-- 戻り値:
-
put
- パラメータ:
entry-clean- putするentryが更新されたものでない場合(他のNodeで読み込まれていても問題ない場合)ture
-
putIfAbsent
-
get
-
remove
-
remove
-
replace
-
replace
-
removeAll
void removeAll() -
keySet
-
getByIndex
-
getListByIndex
-
removeByIndex
-
addCacheEventListenner
-
removeCacheEventListenner
-
getListeners
List<CacheEventListener> getListeners() -
trace
String trace() -
destroy
void destroy()
-