Class BundledCacheLimitPolicy

  • All Implemented Interfaces:
    CacheLimitPolicy

    public class BundledCacheLimitPolicy
    extends Object
    implements CacheLimitPolicy
    A bundled cache limit policy, any two cache policies can be combined.
    • Constructor Detail

      • BundledCacheLimitPolicy

        public BundledCacheLimitPolicy​(CacheLimitPolicy... inputPolicies)
    • Method Detail

      • isSafeToAdd

        public boolean isSafeToAdd​(long toAddSize)
        Description copied from interface: CacheLimitPolicy
        Whether the cache usage is safe to add.
        Specified by:
        isSafeToAdd in interface CacheLimitPolicy
        Returns:
        false if the toAddSize is larger than max available capacity, true otherwise.
      • isOverflow

        public boolean isOverflow​(long toAddSize,
                                  boolean hasFile)
        Description copied from interface: CacheLimitPolicy
        Whether the cache usage is exceeded the upperbound.
        Specified by:
        isOverflow in interface CacheLimitPolicy
        Parameters:
        toAddSize - the size about to add.
        hasFile - whether the file is already in cache.
        Returns:
        true if the cache usage is overflow, false otherwise.