Interface LocalMediaFileCacheService

All Known Implementing Classes:
DefaultLocalMediaFileCacheService

public interface LocalMediaFileCacheService
Interface for managing local media file caching.
  • Method Details

    • storeOrGetAsStream

      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

      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, 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