Interface LocalMediaFileCacheService

    • 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 as FileInputStream build on top of cached file.
        Parameters:
        config - media folder config object
        location - the location
        streamGetter - the stream getter which returns proper data stream for particular Media item.
        Returns:
        the FileInputStream object
        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 regular File taken from cache.
        Parameters:
        config - media folder config object
        location - the location
        streamGetter - the stream getter which returns proper data stream for particular Media item.
        Returns:
        the File object
        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 object
        location - the location of cached file in real storage