Class DefaultLocalMediaFileCacheService.MediaCacheUnit

    • Field Detail

    • Constructor Detail

      • MediaCacheUnit

        public MediaCacheUnit​(java.io.File cachedFile)
    • Method Detail

      • isCachedFileExists

        public boolean isCachedFileExists()
      • getFile

        public java.io.File getFile()
        This method returns direct cached File instance. It marks cache unit with that information thus any possible eviction to that unit will write special zero-bytes marker file in cache folder and will NOT remove file itself. All marked cache files will be removed on next system restart or may be removed by system administrator manually. Remember that in case of getting cache files as regular File instances may exceed declared cache size due to evictions.
        Returns:
        cached file instance
      • getStream

        public java.io.InputStream getStream()
      • markResourceAsEvicted

        public void markResourceAsEvicted()
      • releaseUsageAndRemoveIfMarked

        protected void releaseUsageAndRemoveIfMarked()
      • tryRemoveResourceOrWriteEvictedMarker

        public void tryRemoveResourceOrWriteEvictedMarker()
      • removeResource

        protected void removeResource()
        Removes resource without any checks. Unsafe and not thread safe!
      • getWeight

        public int getWeight()
      • convertNumBytesToCacheUnitWeight

        public static int convertNumBytesToCacheUnitWeight​(long numBytes)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object