eXo Kernel :: Component :: Cache Service 2.4.8-GA

org.exoplatform.services.cache.future
Class FutureCache<K,V,C>

java.lang.Object
  extended by org.exoplatform.services.cache.future.FutureCache<K,V,C>
Type Parameters:
K - the key type parameter
V - the value type parameter
C - the context type parameter
Direct Known Subclasses:
FutureExoCache

public abstract class FutureCache<K,V,C>
extends Object

A future cache that prevents the loading of the same resource twice. This should be used when the resource to load is very expensive or cannot be concurrently retrieved (like a classloading).

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
FutureCache(Loader<K,V,C> loader)
           
 
Method Summary
 V get(C context, K key)
          Perform a cache lookup for the specified key within the specified context.
protected abstract  V get(K key)
           
protected abstract  void put(K key, V value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FutureCache

public FutureCache(Loader<K,V,C> loader)
Method Detail

get

protected abstract V get(K key)

put

protected abstract void put(K key,
                            V value)

get

public final V get(C context,
                   K key)
Perform a cache lookup for the specified key within the specified context. When the value cannot be loaded (because it does not exist or it failed or anything else that does not come to my mind), the value null is returned.

Parameters:
context - the context in which the resource is accessed
key - the key identifying the resource
Returns:
the value

eXo Kernel :: Component :: Cache Service 2.4.8-GA

Copyright © 2014 eXo Platform SAS. All Rights Reserved.