public class ArcacheClient extends Object implements ArcacheClientInterface
| Modifier and Type | Field and Description |
|---|---|
protected ArcacheBackendClient |
backendClient |
protected long |
defaultExpirationTimeSecs |
protected boolean |
defaultHardInvalidation |
protected long |
defaultInvalidationWindowSecs |
protected long |
defaultOperationTimeoutMillis |
protected long |
defaultStoredObjectRemovalTimeSecs |
protected String |
invalidationKeyPrefix |
protected String |
keyDelimiter |
protected String |
keyNamespace |
protected Random |
randomGenerator |
protected long |
timeMeasurementErrorSecs |
| Modifier | Constructor and Description |
|---|---|
|
ArcacheClient() |
protected |
ArcacheClient(ArcacheBackendClient backendClient) |
| Modifier and Type | Method and Description |
|---|---|
Future<CacheGetResult> |
asyncGetCacheObject(String key)
Allow async get
|
Future<Boolean> |
asyncInvalidateKey(String key,
boolean hardInvalidation,
long invalidationWindowSecs) |
Future<Boolean> |
asyncSet(String key,
Object value) |
Future<Boolean> |
asyncSet(String key,
Object value,
String[] invalidationKeys) |
protected Future<CacheGetResult> |
buildCacheGetterTask(String key) |
protected Future<Boolean> |
buildInvalidateKeyTask(String key,
boolean hardInvalidation,
long invalidationWindowSecs) |
String |
createBackendKey(String userKey)
Create the key to be used in the backend client
|
String |
createInvalidationBackendKey(String invalidationKey) |
Object |
get(String key)
This is the most basic get method.
|
Object |
get(String key,
long timeoutMillis) |
ArcacheBackendClient |
getBackendClient() |
CacheGetResult |
getCacheObject(String key) |
CacheGetResult |
getCacheObject(String key,
long timeoutMillis)
This method never throws an exception, in case of an exception it is returned
inside the returned object
|
long |
getDefaultExpirationTime() |
boolean |
getDefaultHardInvalidation() |
long |
getDefaultInvalidationWindow() |
long |
getDefaultOperationTimeout() |
long |
getDefaultStoredObjectRemovalTime() |
String |
getKeyDelimiter() |
String |
getKeyNamespace() |
long |
getTimeMeasurementError() |
void |
invalidateKey(String key)
Invalida una key, utilizando una invalidacion soft o hard segun se haya
configurado, utilizando el invalidationWindow default
|
void |
invalidateKey(String key,
boolean hardInvalidation)
Invalidates a key using the default invalidationWindow
|
void |
invalidateKey(String key,
boolean hardInvalidation,
long invalidationWindowSecs) |
void |
invalidateKey(String key,
long invalidationWindowSecs)
Invalida una key, utilizando una invalidacion soft o hard segun se haya
configurado
|
void |
set(String key,
Object value)
Almacena un valor, como timeout utiliza el default, en caso de falla
retornarĂ¡ una exepcion
|
void |
set(String key,
Object value,
String[] invalidationKeys)
Almacena un valor y define las claves de invalidacion
|
void |
setBackendClient(ArcacheBackendClient backendClient) |
void |
setDefaultExpirationTime(long expirationTimeSecs)
Sets the default value to be used to consider a cached object expired
|
void |
setDefaultHardInvalidation(boolean hardInvalidation) |
void |
setDefaultInvalidationWindow(long windowSecs)
set the default invalidation window, this is the ammount of time to do
probabilistic invalidation.
|
void |
setDefaultOperationTimeout(long timeoutMillis) |
void |
setDefaultStoredObjectRemovalTime(long removeTimeSecs)
Sets the default value to be used to set the lifetime of the object at
backend level.
|
void |
setKeyDelimiter(String keyDelimiter)
Permite configurar un delimitador default para las keys el mismo sera
utilizado par separar las keys de invalidacion y el namespace
|
void |
setKeyNamespace(String namespace)
Permite configurar un namsepace default para todas las keys De esta forma se
puede evitar la colision de keys con otro servicio
|
void |
setTimeMeasurementError(long errorSecs)
Error total en la medicion de tiempos expresado en segundos debe ser 1 +
maxClockOffset + maxKeyCreationTime maxClockOffset (diferencia maxima entre 2
relojes de la infraestructura involucrada) maxKeyCreationTime (Tiempo (95pt)
que demanda generar un valor a ser almacenado)
|
protected long defaultOperationTimeoutMillis
protected long timeMeasurementErrorSecs
protected long defaultInvalidationWindowSecs
protected boolean defaultHardInvalidation
protected String keyNamespace
protected String keyDelimiter
protected String invalidationKeyPrefix
protected long defaultExpirationTimeSecs
protected long defaultStoredObjectRemovalTimeSecs
protected ArcacheBackendClient backendClient
protected Random randomGenerator
public ArcacheClient()
protected ArcacheClient(ArcacheBackendClient backendClient)
public void setBackendClient(ArcacheBackendClient backendClient)
setBackendClient in interface ArcacheConfigurationSetInterfacepublic ArcacheBackendClient getBackendClient()
getBackendClient in interface ArcacheConfigurationGetInterfacepublic void setDefaultOperationTimeout(long timeoutMillis)
setDefaultOperationTimeout in interface ArcacheConfigurationSetInterfacetimeoutMillis - timeoutMillis the default timeout to be used in backend
operationspublic long getDefaultOperationTimeout()
getDefaultOperationTimeout in interface ArcacheConfigurationGetInterfacepublic void setTimeMeasurementError(long errorSecs)
ArcacheConfigurationSetInterfacesetTimeMeasurementError in interface ArcacheConfigurationSetInterfaceerrorSecs - the time measurament error in secondspublic long getTimeMeasurementError()
getTimeMeasurementError in interface ArcacheConfigurationGetInterfacepublic void setDefaultInvalidationWindow(long windowSecs)
ArcacheConfigurationSetInterfacesetDefaultInvalidationWindow in interface ArcacheConfigurationSetInterfacewindowSecs - invalidation window in secondspublic long getDefaultInvalidationWindow()
getDefaultInvalidationWindow in interface ArcacheConfigurationGetInterfacepublic void setDefaultHardInvalidation(boolean hardInvalidation)
setDefaultHardInvalidation in interface ArcacheConfigurationSetInterfacehardInvalidation - default type of invalidation to be usedpublic boolean getDefaultHardInvalidation()
getDefaultHardInvalidation in interface ArcacheConfigurationGetInterfacepublic void setKeyNamespace(String namespace)
ArcacheConfigurationSetInterfacesetKeyNamespace in interface ArcacheConfigurationSetInterfacenamespace - ...public String getKeyNamespace()
getKeyNamespace in interface ArcacheConfigurationGetInterfacepublic void setKeyDelimiter(String keyDelimiter)
ArcacheConfigurationSetInterfacesetKeyDelimiter in interface ArcacheConfigurationSetInterfacekeyDelimiter - ...public String getKeyDelimiter()
getKeyDelimiter in interface ArcacheConfigurationGetInterfacepublic void setDefaultExpirationTime(long expirationTimeSecs)
ArcacheConfigurationSetInterfacesetDefaultExpirationTime in interface ArcacheConfigurationSetInterfaceexpirationTimeSecs - ...public long getDefaultExpirationTime()
getDefaultExpirationTime in interface ArcacheConfigurationGetInterfacepublic void setDefaultStoredObjectRemovalTime(long removeTimeSecs)
ArcacheConfigurationSetInterfacesetDefaultStoredObjectRemovalTime in interface ArcacheConfigurationSetInterfaceremoveTimeSecs - ...public long getDefaultStoredObjectRemovalTime()
getDefaultStoredObjectRemovalTime in interface ArcacheConfigurationGetInterfacepublic Object get(String key) throws TimeoutException, Exception
ArcacheReadWriteInterfaceget in interface ArcacheReadWriteInterfaceTimeoutExceptionExceptionpublic Object get(String key, long timeoutMillis) throws TimeoutException, Exception
get in interface ArcacheReadWriteInterfaceTimeoutExceptionExceptionpublic CacheGetResult getCacheObject(String key)
getCacheObject in interface ArcacheReadWriteInterfacepublic CacheGetResult getCacheObject(String key, long timeoutMillis)
ArcacheReadWriteInterfacegetCacheObject in interface ArcacheReadWriteInterfacepublic Future<CacheGetResult> asyncGetCacheObject(String key)
ArcacheReadWriteInterfaceasyncGetCacheObject in interface ArcacheReadWriteInterfaceprotected Future<CacheGetResult> buildCacheGetterTask(String key)
public void set(String key, Object value) throws TimeoutException, Exception
ArcacheReadWriteInterfaceset in interface ArcacheReadWriteInterfaceTimeoutExceptionExceptionpublic void set(String key, Object value, String[] invalidationKeys) throws TimeoutException, Exception
ArcacheReadWriteInterfaceset in interface ArcacheReadWriteInterfaceTimeoutExceptionExceptionpublic Future<Boolean> asyncSet(String key, Object value)
asyncSet in interface ArcacheReadWriteInterfacepublic Future<Boolean> asyncSet(String key, Object value, String[] invalidationKeys)
asyncSet in interface ArcacheReadWriteInterfacepublic void invalidateKey(String key) throws TimeoutException, Exception
ArcacheInvalidationInterfaceinvalidateKey in interface ArcacheInvalidationInterfaceTimeoutExceptionExceptionpublic void invalidateKey(String key, long invalidationWindowSecs) throws TimeoutException, Exception
ArcacheInvalidationInterfaceinvalidateKey in interface ArcacheInvalidationInterfaceTimeoutExceptionExceptionpublic void invalidateKey(String key, boolean hardInvalidation) throws TimeoutException, Exception
ArcacheInvalidationInterfaceinvalidateKey in interface ArcacheInvalidationInterfaceTimeoutException - when the operation exceeds the
DefaultOperationTimeoutException - when there is a problem with the backend operationpublic void invalidateKey(String key, boolean hardInvalidation, long invalidationWindowSecs) throws TimeoutException, Exception
invalidateKey in interface ArcacheInvalidationInterfaceTimeoutExceptionExceptionpublic Future<Boolean> asyncInvalidateKey(String key, boolean hardInvalidation, long invalidationWindowSecs)
asyncInvalidateKey in interface ArcacheInvalidationInterfaceprotected Future<Boolean> buildInvalidateKeyTask(String key, boolean hardInvalidation, long invalidationWindowSecs)
public String createBackendKey(String userKey)
Copyright © 2019. All rights reserved.