Class RegionCacheAdapter

    • Method Detail

      • getMaxAllowedSize

        public int getMaxAllowedSize()
        Gets total cache size for all regions.
        Specified by:
        getMaxAllowedSize in interface Cache
        Returns:
        the max allowed size
      • invalidate

        public void invalidate​(java.lang.Object[] key,
                               int invalidationType)
        Invokes de.hybris.platform.regioncache.CachegetController().invalidate()
        Specified by:
        invalidate in interface Cache
        Specified by:
        invalidate in interface InvalidationTarget
        Parameters:
        key - may be an incomplete key, for group invalidation
      • removeUnit

        public void removeUnit​(AbstractCacheUnit unit)
        Removes value from the cache
        Specified by:
        removeUnit in interface Cache
        Parameters:
        unit - the unit to be removed. note that the same of any unit with the same key is removed.
      • isForceExclusiveComputation

        public boolean isForceExclusiveComputation()
        We do not load in AbstractCacheUnit.load() (see its comment). This is affecting AbstractCacheUnit.compute(). We have to support old cache flag for this since each cache region is configured separately.
        Specified by:
        isForceExclusiveComputation in interface Cache
      • clear

        public void clear()
        Specified by:
        clear in interface Cache
      • getTenant

        public Tenant getTenant()
        Description copied from interface: Cache
        get the tenant this cache is created for. The hybris 'internal' cache (Tenant.getCache() always has a tenant, but it is possible to create your own Cache without assigning to a tenant.
        Specified by:
        getTenant in interface Cache
        Returns:
        the tenant or null if no tenant set
      • setEnabled

        public void setEnabled​(boolean enabled)
        Description copied from interface: Cache
        enables/disables the cache.
        Specified by:
        setEnabled in interface Cache
        Parameters:
        enabled - true for enabling the cache, false otherwise.
      • getGetCount

        public long getGetCount()
        Specified by:
        getGetCount in interface Cache
        Returns:
        how many entities where requested from the cache since creation of the cache. This is reseted by calling Cache.clear() or Cache.clearStats().
      • getMissCount

        public long getMissCount()
        Specified by:
        getMissCount in interface Cache
        Returns:
        how many entities where requested from the cache but wasn't in the cache (yet) since creation of the cache. This is reseted by calling Cache.clear() or Cache.clearStats().
      • statsEnabled

        public boolean statsEnabled()
        Description copied from interface: Cache
        Returns true if the statistics for the cache are enabled. This can be modified with the method Cache.setStatsEnabled(boolean). Collecting the statistics is very memory intensive - use Cache.clearStats() frequently.
        Specified by:
        statsEnabled in interface Cache
        Returns:
        false otherwise.
      • setStatsEnabled

        public void setStatsEnabled​(boolean on)
        Description copied from interface: Cache
        Enables or disables the cache statistics.
        Specified by:
        setStatsEnabled in interface Cache
        Parameters:
        on - true for enabling the statistics
      • clearStats

        public void clearStats()
        Description copied from interface: Cache
        Clears the collected cache statistics.
        Specified by:
        clearStats in interface Cache
      • isStatsEmpty

        public boolean isStatsEmpty()
        Description copied from interface: Cache
        Returns true if no cache statistics are collected. addToStatistics(Object[], boolean) was not called yet)
        Specified by:
        isStatsEmpty in interface Cache
        Returns:
        false otherwise
      • getMaxReachedSize

        public int getMaxReachedSize()
        Description copied from interface: Cache
        the maximum reached number of entries since creation of the cache. this is only reseted if Cache#clearCache() is called.
        Specified by:
        getMaxReachedSize in interface Cache
      • getStatistics

        public java.util.Set<? extends CacheStatisticsEntry> getStatistics​(int upperBound,
                                                                           int lowerBound)
        FIXME: verify
        Specified by:
        getStatistics in interface Cache
        Parameters:
        upperBound - the upper bound for the returned set. Each entry factor is equal or less.
        lowerBound - the lower bound the the returned set. Each entry factor is greater or equal.
        Returns:
        a Set with DefaultCacheStatisticsEntry.
      • getAbstractCacheUnit

        public AbstractCacheUnit getAbstractCacheUnit​(java.lang.String firstKeyElement,
                                                      java.lang.String secondKeyElement,
                                                      java.lang.String thirdKeyElement,
                                                      PK fourthKeyElement)
        Description copied from interface: Cache
        for performance optimizations: get a existing cache unit; the key of the cache unit must consist of exactly three elements
        Specified by:
        getAbstractCacheUnit in interface Cache
      • getTenantId

        public java.lang.String getTenantId()
        Specified by:
        getTenantId in interface Cache
      • enableStats

        public void enableStats​(boolean enabled)
        Specified by:
        enableStats in interface Cache
      • getSize

        public int getSize()
        Specified by:
        getSize in interface Cache
      • destroy

        public void destroy()
        Description copied from interface: Cache
        Method called by tennant to free resources before object is finalized
        Specified by:
        destroy in interface Cache
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        For sake of registering only one adapter in controller
        Overrides:
        equals in class java.lang.Object
      • toString

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