Package lumis.portal.cache
Class SingleOrBulkLoadCacheDataProvider<T>
- java.lang.Object
-
- lumis.portal.cache.SingleOrBulkLoadCacheDataProvider<T>
-
- Type Parameters:
T
- the cache type.
- All Implemented Interfaces:
ICacheMultiDataProvider<T>
public abstract class SingleOrBulkLoadCacheDataProvider<T> extends java.lang.Object implements ICacheMultiDataProvider<T>
AbstractICacheMultiDataProvider
that eases the use of single and bulk loads, based on a given condition. Also, provides synchronization, to avoid multiple bulk loads at the same time.- Since:
- 11.0.0
- Version:
- $Revision$ $Date$
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface lumis.portal.cache.ICacheMultiDataProvider
ICacheMultiDataProvider.IRequest
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Integer
lastBulkloadReadsize
Stores the last bulk load size.
-
Constructor Summary
Constructors Constructor Description SingleOrBulkLoadCacheDataProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.util.Collection<CacheItem<T>>
doBulkLoad(ICacheMultiDataProvider.IRequest request)
Performs a bulk load.protected abstract CacheItem<T>
doSingleLoad(ICacheMultiDataProvider.IRequest request)
Performs a single load.java.util.Collection<CacheItem<T>>
loadData(ICacheMultiDataProvider.IRequest request)
Returns the data to be loaded into the cache.protected boolean
shouldBulkLoad(ICacheMultiDataProvider.IRequest request)
Returns whether thebulk load
should be performed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.portal.cache.ICacheMultiDataProvider
getDefaultValue
-
-
-
-
Method Detail
-
loadData
public java.util.Collection<CacheItem<T>> loadData(ICacheMultiDataProvider.IRequest request) throws PortalException
Description copied from interface:ICacheMultiDataProvider
Returns the data to be loaded into the cache.- Specified by:
loadData
in interfaceICacheMultiDataProvider<T>
- Parameters:
request
- a request object containing information about the requested data.- Returns:
- a collection of cache items to be cached. If a cache item for the requested key is not present in the
returned collection, it will be assumed its value is
ICacheMultiDataProvider.getDefaultValue()
. - Throws:
PortalException
-
doSingleLoad
protected abstract CacheItem<T> doSingleLoad(ICacheMultiDataProvider.IRequest request) throws PortalException
Performs a single load.- Parameters:
request
- the cache request.- Returns:
- the cache item.
- Throws:
PortalException
- Since:
- 11.0.0
-
doBulkLoad
protected abstract java.util.Collection<CacheItem<T>> doBulkLoad(ICacheMultiDataProvider.IRequest request) throws PortalException
Performs a bulk load.- Parameters:
request
- the cache request.- Returns:
- the cache items.
- Throws:
PortalException
- Since:
- 11.0.0
-
shouldBulkLoad
protected boolean shouldBulkLoad(ICacheMultiDataProvider.IRequest request)
Returns whether thebulk load
should be performed. Iffalse
, asingle load
will be performed, instead.- Parameters:
request
- the request.- Returns:
- whether the
bulk load
should be performed. - Since:
- 11.0.0
-
-