public class ArcacheSpeedupClient extends Object implements ArcacheBackendClient, ArcacheSpeedupConfigurationSetInterface, ArcacheSpeedupConfigurationGetInterface
| Modifier and Type | Field and Description |
|---|---|
protected ArcacheBackendClient |
backendClient |
protected boolean |
cacheIsolation |
protected ProbabilityFunction |
expirationProbabilityFunction |
protected boolean |
initialized |
protected ArcacheInMemoryClient |
invalidationKeysCache |
protected int |
invalidationKeysCacheSize |
protected long |
invalidationKeysExpirationMillis |
protected ArcacheInMemoryClient |
missesCache |
protected int |
missesCacheSize |
protected long |
missesExpirationMillis |
protected ArcacheInMemoryClient |
objectsCache |
protected int |
objectsCacheSize |
protected long |
objectsExpirationMillis |
protected boolean |
protectAgainstBackendFailures |
protected Random |
random |
protected long |
speedupCacheTTLMillis |
protected ArcacheSpeedupTracker |
tracker |
| Constructor and Description |
|---|
ArcacheSpeedupClient() |
| Modifier and Type | Method and Description |
|---|---|
Future<Object> |
asyncGet(String key) |
Future<Boolean> |
asyncSet(String key,
long ttlMillis,
Object value) |
void |
clear() |
protected ar.com.siripo.arcache.backend.speedup.FutureBackendGetWrapper |
createFutureBackendGetWrapper(Future<Object> backendFuture,
String key) |
protected SpeedupCacheObject |
createSpeedupCacheObject(Object value) |
ArcacheBackendClient |
getBackendClient()
Get the inner backend client
|
boolean |
getCacheIsolation() |
ProbabilityFunction |
getExpirationProbabilityFunction()
Get the probability function to be used in expiration evaluation
|
int |
getInvalidationKeysCacheSize()
Get the maximum size of invalidationKeys Cache in number of elements
|
long |
getInvalidationKeysExpirationMillis()
Get the expiration of the stored values in milliseconds
|
int |
getMissesCacheSize()
Get the maximum size of misses Cache in number of elements
|
long |
getMissesExpirationMillis()
Get the expiration of the stored values in milliseconds
|
int |
getObjectsCacheSize()
Get the maximum size of objects Cache in number of elements
|
long |
getObjectsExpirationMillis()
Get the expiration of the stored values in milliseconds
|
boolean |
getProtectAgainstBackendFailures()
Allow some protection against backend failures.
|
long |
getSpeedupCacheTTLMillis()
Get the speedup cache ttl in milli seconds, this value must be restricted by
the cache size, the ttl is allowed to make a hard expiration if its needed.
|
ArcacheSpeedupTracker |
getTracker()
Get a tracker to keep control of speedup performance and malfunctions
|
void |
initialize() |
protected RestoredSpeedupCacheObject |
restoreObjectFromAnySpeedupCache(String key) |
protected RestoredSpeedupCacheObject |
restoreObjectFromSpeedupCache(String key,
ArcacheInMemoryClient speedupCache,
long timeoutMillis) |
void |
setBackendClient(ArcacheBackendClient backendClient)
Set the inner backend client
|
void |
setCacheIsolation(boolean cacheIsolation)
Enable the cache isolation (disabled by default), when cache isolation is
enabled, the stored objects are immutable but with an performance cost.
|
void |
setExpirationProbabilityFunction(ProbabilityFunction probabilityFunction)
Set the probability function to be used in expiration evaluation
|
void |
setInvalidationKeysCacheSize(int cacheSize)
Set the maximum size of invalidationKeys Cache in number of elements
|
void |
setInvalidationKeysExpirationMillis(long expirationMillis)
Set the expiration of the stored values in milliseconds
|
void |
setMissesCacheSize(int cacheSize)
Set the maximum size of misses Cache in number of elements
|
void |
setMissesExpirationMillis(long expirationMillis)
Set the expiration of the stored values in milliseconds
|
void |
setObjectsCacheSize(int cacheSize)
Set the maximum size of objects Cache in number of elements
|
void |
setObjectsExpirationMillis(long expirationMillis)
Set the expiration of the stored values in milliseconds
|
void |
setProtectAgainstBackendFailures(boolean protect)
Allow some protection against backend failures.
|
void |
setSpeedupCacheTTLMillis(long ttlMillis)
Set the speedup cache ttl in milli seconds, this value must be restricted by
the cache size, the ttl is allowed to make a hard expiration if its needed.
|
void |
setTracker(ArcacheSpeedupTracker tracker)
Set a tracker to keep control of speedup performance and malfunctions
|
protected ArcacheInMemoryClient |
storeSpeedupCache(String key,
Object value) |
protected void |
validateSetCacheSize(int cachesize) |
protected void |
validateSetExpirationMillis(long expirationMillis) |
protected ArcacheBackendClient backendClient
protected int invalidationKeysCacheSize
protected int objectsCacheSize
protected int missesCacheSize
protected long invalidationKeysExpirationMillis
protected long objectsExpirationMillis
protected long missesExpirationMillis
protected boolean protectAgainstBackendFailures
protected long speedupCacheTTLMillis
protected ProbabilityFunction expirationProbabilityFunction
protected ArcacheSpeedupTracker tracker
protected boolean cacheIsolation
protected ArcacheInMemoryClient invalidationKeysCache
protected ArcacheInMemoryClient objectsCache
protected ArcacheInMemoryClient missesCache
protected boolean initialized
protected Random random
public void setBackendClient(ArcacheBackendClient backendClient)
ArcacheSpeedupConfigurationSetInterfacesetBackendClient in interface ArcacheSpeedupConfigurationSetInterfacepublic void setInvalidationKeysCacheSize(int cacheSize)
ArcacheSpeedupConfigurationSetInterfacesetInvalidationKeysCacheSize in interface ArcacheSpeedupConfigurationSetInterfacepublic void setObjectsCacheSize(int cacheSize)
ArcacheSpeedupConfigurationSetInterfacesetObjectsCacheSize in interface ArcacheSpeedupConfigurationSetInterfacepublic void setMissesCacheSize(int cacheSize)
ArcacheSpeedupConfigurationSetInterfacesetMissesCacheSize in interface ArcacheSpeedupConfigurationSetInterfacepublic void setInvalidationKeysExpirationMillis(long expirationMillis)
ArcacheSpeedupConfigurationSetInterfacesetInvalidationKeysExpirationMillis in interface ArcacheSpeedupConfigurationSetInterfacepublic void setObjectsExpirationMillis(long expirationMillis)
ArcacheSpeedupConfigurationSetInterfacesetObjectsExpirationMillis in interface ArcacheSpeedupConfigurationSetInterfacepublic void setMissesExpirationMillis(long expirationMillis)
ArcacheSpeedupConfigurationSetInterfacesetMissesExpirationMillis in interface ArcacheSpeedupConfigurationSetInterfacepublic void setProtectAgainstBackendFailures(boolean protect)
ArcacheSpeedupConfigurationSetInterfacesetProtectAgainstBackendFailures in interface ArcacheSpeedupConfigurationSetInterfacepublic void setSpeedupCacheTTLMillis(long ttlMillis)
ArcacheSpeedupConfigurationSetInterfacesetSpeedupCacheTTLMillis in interface ArcacheSpeedupConfigurationSetInterfacepublic void setExpirationProbabilityFunction(ProbabilityFunction probabilityFunction)
ArcacheSpeedupConfigurationSetInterfacesetExpirationProbabilityFunction in interface ArcacheSpeedupConfigurationSetInterfacepublic void setTracker(ArcacheSpeedupTracker tracker)
ArcacheSpeedupConfigurationSetInterfacesetTracker in interface ArcacheSpeedupConfigurationSetInterfacepublic ArcacheBackendClient getBackendClient()
ArcacheSpeedupConfigurationGetInterfacegetBackendClient in interface ArcacheSpeedupConfigurationGetInterfacepublic int getInvalidationKeysCacheSize()
ArcacheSpeedupConfigurationGetInterfacegetInvalidationKeysCacheSize in interface ArcacheSpeedupConfigurationGetInterfacepublic int getObjectsCacheSize()
ArcacheSpeedupConfigurationGetInterfacegetObjectsCacheSize in interface ArcacheSpeedupConfigurationGetInterfacepublic int getMissesCacheSize()
ArcacheSpeedupConfigurationGetInterfacegetMissesCacheSize in interface ArcacheSpeedupConfigurationGetInterfacepublic long getInvalidationKeysExpirationMillis()
ArcacheSpeedupConfigurationGetInterfacegetInvalidationKeysExpirationMillis in interface ArcacheSpeedupConfigurationGetInterfacepublic long getObjectsExpirationMillis()
ArcacheSpeedupConfigurationGetInterfacegetObjectsExpirationMillis in interface ArcacheSpeedupConfigurationGetInterfacepublic long getMissesExpirationMillis()
ArcacheSpeedupConfigurationGetInterfacegetMissesExpirationMillis in interface ArcacheSpeedupConfigurationGetInterfacepublic boolean getProtectAgainstBackendFailures()
ArcacheSpeedupConfigurationGetInterfacegetProtectAgainstBackendFailures in interface ArcacheSpeedupConfigurationGetInterfacepublic long getSpeedupCacheTTLMillis()
ArcacheSpeedupConfigurationGetInterfacegetSpeedupCacheTTLMillis in interface ArcacheSpeedupConfigurationGetInterfacepublic ProbabilityFunction getExpirationProbabilityFunction()
ArcacheSpeedupConfigurationGetInterfacegetExpirationProbabilityFunction in interface ArcacheSpeedupConfigurationGetInterfacepublic ArcacheSpeedupTracker getTracker()
ArcacheSpeedupConfigurationGetInterfacegetTracker in interface ArcacheSpeedupConfigurationGetInterfacepublic boolean getCacheIsolation()
getCacheIsolation in interface ArcacheSpeedupConfigurationGetInterfacepublic void setCacheIsolation(boolean cacheIsolation)
ArcacheSpeedupConfigurationSetInterfacesetCacheIsolation in interface ArcacheSpeedupConfigurationSetInterfacepublic void initialize()
public void clear()
protected void validateSetCacheSize(int cachesize)
protected void validateSetExpirationMillis(long expirationMillis)
public Future<Boolean> asyncSet(String key, long ttlMillis, Object value)
asyncSet in interface ArcacheBackendClientprotected ArcacheInMemoryClient storeSpeedupCache(String key, Object value)
protected SpeedupCacheObject createSpeedupCacheObject(Object value)
public Future<Object> asyncGet(String key)
asyncGet in interface ArcacheBackendClientprotected ar.com.siripo.arcache.backend.speedup.FutureBackendGetWrapper createFutureBackendGetWrapper(Future<Object> backendFuture, String key)
protected RestoredSpeedupCacheObject restoreObjectFromAnySpeedupCache(String key)
protected RestoredSpeedupCacheObject restoreObjectFromSpeedupCache(String key, ArcacheInMemoryClient speedupCache, long timeoutMillis)
Copyright © 2019. All rights reserved.