Package de.hybris.platform.media.storage
Interface LocalMediaFileCacheService
-
- All Known Implementing Classes:
DefaultLocalMediaFileCacheService
public interface LocalMediaFileCacheServiceInterface for managing local media file caching.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceLocalMediaFileCacheService.StreamGetter
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidremoveFromCache(MediaStorageConfigService.MediaFolderConfig config, java.lang.String location)Removes given media from local cache.java.io.FilestoreOrGetAsFile(MediaStorageConfigService.MediaFolderConfig config, java.lang.String location, LocalMediaFileCacheService.StreamGetter streamGetter)Checks whether there is local cached version of media data and stores it if not, then returns it as regularFiletaken from cache.java.io.InputStreamstoreOrGetAsStream(MediaStorageConfigService.MediaFolderConfig config, java.lang.String location, LocalMediaFileCacheService.StreamGetter streamGetter)Checks whether there is local cached version of media data and stores it if not, then returns it asFileInputStreambuild on top of cached file.
-
-
-
Method Detail
-
storeOrGetAsStream
java.io.InputStream storeOrGetAsStream(MediaStorageConfigService.MediaFolderConfig config, java.lang.String location, LocalMediaFileCacheService.StreamGetter streamGetter)
Checks whether there is local cached version of media data and stores it if not, then returns it asFileInputStreambuild on top of cached file.- Parameters:
config- media folder config objectlocation- the locationstreamGetter- the stream getter which returns proper data stream for particularMediaitem.- Returns:
- the
FileInputStreamobject - Throws:
MediaNotFoundException- when cached media does not exist and cannot be returned
-
storeOrGetAsFile
java.io.File storeOrGetAsFile(MediaStorageConfigService.MediaFolderConfig config, java.lang.String location, LocalMediaFileCacheService.StreamGetter streamGetter)
Checks whether there is local cached version of media data and stores it if not, then returns it as regularFiletaken from cache.- Parameters:
config- media folder config objectlocation- the locationstreamGetter- the stream getter which returns proper data stream for particularMediaitem.- Returns:
- the
Fileobject - Throws:
MediaNotFoundException- when cached media does not exist and cannot be returned
-
removeFromCache
void removeFromCache(MediaStorageConfigService.MediaFolderConfig config, java.lang.String location)
Removes given media from local cache. This method is safe in terms of whenever some stream is already opened it will wait with removing cached file from disk until last client will close stream.- Parameters:
config- media folder config objectlocation- the location of cached file in real storage
-
-