public class ImageCacheElementProvider extends Object implements AccessRestrictedCacheElementProvider<ImageCacheKey,Image>
ImageProvider
.ETERNAL_TIME_TO_LIVE
Constructor and Description |
---|
ImageCacheElementProvider(String typeName,
ImageProvider imageProvider,
ImageDiskCache diskCache) |
Modifier and Type | Method and Description |
---|---|
void |
assertAccess(ImageCacheKey cacheKey) |
String |
getContentType()
Returns a unique string naming the content type of the elements provided by this provider
(e.g.
|
int |
getTimeToLive()
Returns the time in seconds describing how long a provided element will be cached without
expiring (when it is not replaced manually).
|
Image |
load(ImageCacheKey key)
Provides an element identified by the key for caching.
|
public ImageCacheElementProvider(String typeName, ImageProvider imageProvider, ImageDiskCache diskCache)
typeName
- The type this provider is used for.imageProvider
- The image provider.diskCache
- storage for caching images locally as files on diskpublic void assertAccess(ImageCacheKey cacheKey) throws AuthorizationException
assertAccess
in interface AccessRestrictedCacheElementProvider<ImageCacheKey,Image>
cacheKey
- The key to check access against.AuthorizationException
- Thrown, when the user is not allowed to access the item.public String getContentType()
CacheElementProvider
getContentType
in interface CacheElementProvider<ImageCacheKey,Image>
public int getTimeToLive()
CacheElementProvider
CacheElementProvider.ETERNAL_TIME_TO_LIVE
when the
element should never expire.getTimeToLive
in interface CacheElementProvider<ImageCacheKey,Image>
public Image load(ImageCacheKey key) throws CacheElementProviderException
CacheElementProvider
load
in interface CacheElementProvider<ImageCacheKey,Image>
key
- The key, to be used to load the image.CacheElementProviderException
- in case the loading failed and nothing should or can be cachedCopyright © 2019 Communote team. All rights reserved.