/** * Remove all data from cache. This will clear all data stored by the * {@link CacheManager} of the {@link SpiceService}. */ public Future<?> removeAllDataFromCache() { return executeCommand(new RemoveAllDataFromCacheCommand(this)); }
/** * Remove some specific content from cache * @param clazz * the Type of data you want to remove from cache * @param cacheKey * the key of the object in cache */ public <T> Future<?> removeDataFromCache(final Class<T> clazz, final Object cacheKey) { if (clazz == null || cacheKey == null) { throw new IllegalArgumentException("Both parameters must be non null."); } return executeCommand(new RemoveDataFromCacheCommand(this, clazz, cacheKey)); }
/** * Remove some specific content from cache * @param clazz * the type of data you want to remove from cache. */ public <T> Future<?> removeDataFromCache(final Class<T> clazz) { if (clazz == null) { throw new IllegalArgumentException("Clazz must be non null."); } return executeCommand(new RemoveDataClassFromCacheCommand(this, clazz)); }
/** * Configure the behavior in case of error during reading/writing cache. <br/> * Specify wether an error on reading/writing cache must fail the process. * @param failOnCacheError * true if an error must fail the process */ public void setFailOnCacheError(final boolean failOnCacheError) { executeCommand(new SetFailOnCacheErrorCommand(this, failOnCacheError)); }
public void removeSpiceServiceListener(SpiceServiceListener spiceServiceListener) { executeCommand(new RemoveSpiceServiceListenerCommand(this, spiceServiceListener)); }
public Future<List<Object>> getAllCacheKeys(final Class<?> clazz) { return executeCommand(new GetAllCacheKeysCommand(this, clazz)); }
/** * Returns the last date of storage of a given data into the cache. * @param clazz * the class of the result to retrieve from cache. * @param cacheKey * the key used to store and retrieve the result of the request * in the cache * @return the date at which data has been stored in cache. Null if no such * data is in Cache. * @throws CacheLoadingException * Exception thrown when a problem occurs while loading data * from cache. */ public Future<Date> getDateOfDataInCache(Class<?> clazz, final Object cacheKey) throws CacheCreationException { return executeCommand(new GetDateOfDataInCacheCommand(this, clazz, cacheKey)); }
public void addSpiceServiceListener(SpiceServiceListener spiceServiceListener) { executeCommand(new AddSpiceServiceListenerCommand(this, spiceServiceListener)); }
public <T> Future<List<T>> getAllDataFromCache(final Class<T> clazz) throws CacheLoadingException { return executeCommand(new GetAllDataFromCacheCommand<T>(this, clazz)); }
/** * Get some data previously saved in cache with key <i>requestCacheKey</i>. * This method doesn't perform any network processing, it just checks if * there are previously saved data. Don't call this method in the main * thread because you could block it. Instead, use the asynchronous version * of this method: * {@link #getFromCache(Class, Object, long, RequestListener)}. * @param clazz * the class of the result to retrieve from cache. * @param cacheKey * the key used to store and retrieve the result of the request * in the cache * @return a future object that will hold data in cache. Calling get on this * future will block until the data is actually effectively taken * from cache. * @throws CacheLoadingException * Exception thrown when a problem occurs while loading data * from cache. */ public <T> Future<T> getDataFromCache(final Class<T> clazz, final Object cacheKey) throws CacheLoadingException { return executeCommand(new GetDataFromCacheCommand<T>(this, clazz, cacheKey)); }
/** * Put some new data in cache using cache key <i>requestCacheKey</i>. This * method doesn't perform any network processing, it just data in cache, * erasing any previsouly saved date in cache using the same class and key. * Don't call this method in the main thread because you could block it. * Instead, use the asynchronous version of this method: * {@link #putInCache(Class, Object, Object)}. * @param cacheKey * the key used to store and retrieve the result of the request * in the cache * @param data * the data to be saved in cache. * @return the data has it has been saved by an ObjectPersister in cache. * @throws CacheLoadingException * Exception thrown when a problem occurs while loading data * from cache. */ public <T> Future<T> putDataInCache(final Object cacheKey, final T data) throws CacheSavingException, CacheCreationException { return executeCommand(new PutDataInCacheCommand<T>(this, data, cacheKey)); }
/** * Tests whether some data is present in cache or not. * @param clazz * the class of the result to retrieve from cache. * @param cacheKey * the key used to store and retrieve the result of the request * in the cache * @param cacheExpiryDuration * duration in milliseconds after which the content of the cache * will be considered to be expired. * {@link DurationInMillis#ALWAYS_RETURNED} means data in cache * is always returned if it exists. * {@link DurationInMillis#ALWAYS_EXPIRED} means data in cache is * never returned.(see {@link DurationInMillis}) * @return the data has it has been saved by an ObjectPersister in cache. * @throws CacheCreationException * Exception thrown when a problem occurs while looking for data * in cache. */ public Future<Boolean> isDataInCache(Class<?> clazz, final Object cacheKey, long cacheExpiryDuration) throws CacheCreationException { return executeCommand(new IsDataInCacheCommand(this, clazz, cacheKey, cacheExpiryDuration)); }