Class CacheWriterIntegration<K,V>
java.lang.Object
com.loomcache.server.jcache.CacheWriterIntegration<K,V>
- Type Parameters:
K- the key typeV- the value type
Manages write-through and write-behind cache strategies.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final recordConfiguration for write-behind mode.static final recordWrite-behind statistics snapshot. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a write-through integration.CacheWriterIntegration(CacheWriterIntegration.BackingStoreWriter<K, V> writer, CacheWriterIntegration.WriteBehindConfig config) Create a write-behind integration. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close and flush pending writes.static <K,V> CacheWriterIntegration <K, V> fromMapStore(MapStore<K, V> mapStore, MapStoreConfig config) Bridge factory: wire aMapStorethrough the JCache write-through / write-behind machinery by wrapping it in aMapStoreBackedCacheWriter.@Nullable CacheWriterIntegration.WriteBehindStatsGet write-behind statistics.voidWrite a key-value pair.
-
Constructor Details
-
CacheWriterIntegration
Create a write-through integration. -
CacheWriterIntegration
public CacheWriterIntegration(CacheWriterIntegration.BackingStoreWriter<K, V> writer, CacheWriterIntegration.WriteBehindConfig config) Create a write-behind integration.
-
-
Method Details
-
fromMapStore
public static <K,V> CacheWriterIntegration<K,V> fromMapStore(MapStore<K, V> mapStore, MapStoreConfig config) Bridge factory: wire aMapStorethrough the JCache write-through / write-behind machinery by wrapping it in aMapStoreBackedCacheWriter.When the supplied
MapStoreConfigis write-behind, JCache's scheduler is used — theMapStoreConfig'swriteBatchSizeandwriteDelaycontrol its batching (with a fixedmaxRetriesof 3). When the config is write-through, the returned integration is synchronous. -
write
-
getWriteBehindStats
Get write-behind statistics. -
close
public void close()Close and flush pending writes.
-