Package de.hybris.platform.media.storage
Interface LocalMediaFileCacheService
- All Known Implementing Classes:
DefaultLocalMediaFileCacheService
public interface LocalMediaFileCacheService
Interface for managing local media file caching.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidremoveFromCache(MediaStorageConfigService.MediaFolderConfig config, String location) Removes given media from local cache.storeOrGetAsFile(MediaStorageConfigService.MediaFolderConfig config, 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.storeOrGetAsStream(MediaStorageConfigService.MediaFolderConfig config, 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 Details
-
storeOrGetAsStream
InputStream storeOrGetAsStream(MediaStorageConfigService.MediaFolderConfig config, 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
File storeOrGetAsFile(MediaStorageConfigService.MediaFolderConfig config, 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
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
-