org.silverpeas.cache.service.Handler
Class CacheValueHandler<V>

java.lang.Object
  extended by org.silverpeas.cache.service.Handler.CacheValueHandler<V>
Direct Known Subclasses:
RequestCacheValueHandler

public abstract class CacheValueHandler<V>
extends Object

The aim of this abstraction is to factorize the treatment of simple uses of cache. In most cases, the use of the cache is : - 1 : checking that a value exists from the cache behind a key - 2 : if it exists, using it - 3 : if it doesn't exist, computing the value to be cached, caching it and using it User: Yohann Chastagnier Date: 30/12/13


Constructor Summary
protected CacheValueHandler()
          Default constructor.
 
Method Summary
protected abstract  V defaultValue()
          Provides a default value to be registred in the cache.
 V get()
          Gets the value from the cache.
protected abstract  String getCacheKeySuffix()
          Gets the suffix key to access the value in the cache.
protected abstract
<C extends SimpleCacheService>
C
getCacheService()
          Gets the cache service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheValueHandler

protected CacheValueHandler()
Default constructor.

Method Detail

getCacheService

protected abstract <C extends SimpleCacheService> C getCacheService()
Gets the cache service.

Type Parameters:
C -
Returns:

getCacheKeySuffix

protected abstract String getCacheKeySuffix()
Gets the suffix key to access the value in the cache. The prefix of key is the name of the class (package name included) of the handler.

Returns:

get

public V get()
Gets the value from the cache.

Returns:

defaultValue

protected abstract V defaultValue()
Provides a default value to be registred in the cache. If default value is null, then nothing is cached.

Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.