|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.portal.cache.PortalCache<T>
T
- Type of the objects that will be cached.@StableMinor(version="5.5", sinceVersion="4.0") public class PortalCache<T>
Memory cache for portal objects. The identifier of a portal cache instance (given in the constructor) must be unique.
Field Summary | |
---|---|
static int |
MAX_AGE_INFINITE
Value that indicates that there is no maximum age for entries in this cache. |
Constructor Summary | |
---|---|
PortalCache(String cacheId)
|
|
PortalCache(String cacheId,
boolean autoClone)
|
|
PortalCache(String cacheId,
ICacheDataProvider<T> defaultCacheDataProvider)
Creates a portal cache instance with the specified identifier and cache data provider. |
Method Summary | |
---|---|
void |
clear()
|
void |
clear(ITransaction transaction)
Clears the cache and disables it until the given transaction ends. |
static void |
clearAll()
|
void |
destroy()
|
T |
fetch(String key)
Obtain the value associated with the specified key. |
T |
fetch(String key,
ICacheDataProvider<T> cacheDataProvider)
Obtain the value associated with the specified key. |
T |
get(String key)
|
static PortalCache |
getCache(String cacheId)
|
static Collection<String> |
getCacheIds()
|
int |
getCapacity()
Returns the current capacity of this portal cache. |
String |
getId()
|
int |
getMaxAgeSeconds()
Returns the current maximum age for entries in this cache. |
int |
getSize()
Returns the number of entries currently stored in this cache. |
ICacheStatistics |
getStatistics()
|
void |
put(String key,
T value)
|
void |
remove(String key)
|
void |
remove(String key,
ITransaction transaction)
Removes an entry from the cache now and after the given transaction ends. |
void |
setCapacity(int newCapacity)
Sets the capacity for this portal cache. |
void |
setMaxAgeSeconds(int maxAgeSeconds)
Sets the maximum age for entries in this cache. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_AGE_INFINITE
Constructor Detail |
---|
public PortalCache(String cacheId)
public PortalCache(String cacheId, ICacheDataProvider<T> defaultCacheDataProvider)
cacheId
- the cache identifier.defaultCacheDataProvider
- the default cache data provider for this
cache instance.public PortalCache(String cacheId, boolean autoClone)
Method Detail |
---|
public static void clearAll()
public String getId()
public String toString()
toString
in class Object
public int getMaxAgeSeconds()
MAX_AGE_INFINITE
to
indicate there is no maximum age.public void setMaxAgeSeconds(int maxAgeSeconds)
maxAgeSeconds
- the maximum age in seconds,
or MAX_AGE_INFINITE
to indicate there is no maximum age.public T get(String key)
public T fetch(String key) throws PortalException
ICacheDataProvider
of this
PortalCache is used to read the value, and it is cached.
key
- the key.
UnsupportedOperationException
- if there is no
ICacheDataProvider
specified for this
cache instance.
PortalException
- if ICacheDataProvider.loadData(String)
throws it.
RuntimeException
- any runtime exception thrown by
ICacheDataProvider.loadData(String)
is thrown by this method.public T fetch(String key, ICacheDataProvider<T> cacheDataProvider) throws PortalException
key
- the key.cacheDataProvider
- the data provider used if the value is not
currently available in the cache.
PortalException
- if ICacheDataProvider.loadData(String)
throws it.
RuntimeException
- any runtime exception thrown by
ICacheDataProvider.loadData(String)
is thrown by this method.public void put(String key, T value)
public void remove(String key)
public void remove(String key, ITransaction transaction) throws PortalException
key
- the entry key.transaction
- the transaction.
PortalException
public void clear()
public void clear(ITransaction transaction) throws PortalException
transaction
- the transaction.
PortalException
public int getSize()
public int getCapacity()
public void setCapacity(int newCapacity)
public void destroy()
public ICacheStatistics getStatistics()
public static PortalCache getCache(String cacheId)
public static Collection<String> getCacheIds()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |