Class DefaultLocalMediaFileCacheService.MediaCacheUnit
- java.lang.Object
-
- de.hybris.platform.media.storage.impl.DefaultLocalMediaFileCacheService.MediaCacheUnit
-
- Enclosing class:
- DefaultLocalMediaFileCacheService
public static class DefaultLocalMediaFileCacheService.MediaCacheUnit extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static intMIN_UNIT_WEIGHT_IN_KB
-
Constructor Summary
Constructors Constructor Description MediaCacheUnit(java.io.File cachedFile)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intconvertNumBytesToCacheUnitWeight(long numBytes)java.io.FilegetFile()This method returns direct cached File instance.java.io.InputStreamgetStream()intgetWeight()booleanisCachedFileExists()voidmarkResourceAsEvicted()protected voidreleaseUsageAndRemoveIfMarked()protected voidremoveResource()Removes resource without any checks.java.lang.StringtoString()voidtryRemoveResourceOrWriteEvictedMarker()
-
-
-
Field Detail
-
MIN_UNIT_WEIGHT_IN_KB
public static final int MIN_UNIT_WEIGHT_IN_KB
- See Also:
- Constant Field Values
-
-
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:
toStringin classjava.lang.Object
-
-