Interface Cache

    • Field Detail

      • CACHEKEY_HJMP

        static final java.lang.String CACHEKEY_HJMP
      • CACHEKEY_ENTITY

        static final java.lang.String CACHEKEY_ENTITY
      • CACHEKEY_FIND

        static final java.lang.String CACHEKEY_FIND
      • CACHEKEY_FLEXSEARCH

        static final java.lang.String CACHEKEY_FLEXSEARCH
      • CACHEKEY_ENTITYISALIVE

        static final java.lang.String CACHEKEY_ENTITYISALIVE
      • CACHEKEY_JALOITEMDATA

        static final java.lang.String CACHEKEY_JALOITEMDATA
      • CACHEKEY_JALOTYPE

        static final java.lang.String CACHEKEY_JALOTYPE
      • CACHEKEY_JALOITEMCACHE

        static final java.lang.String CACHEKEY_JALOITEMCACHE
      • CACHEKEY_CUSTOM

        static final java.lang.String CACHEKEY_CUSTOM
      • CACHEKEY_C2LMANAGER

        static final java.lang.String CACHEKEY_C2LMANAGER
      • CONFIG_CONCURRENCY_LEVEL

        static final java.lang.String CONFIG_CONCURRENCY_LEVEL
        See Also:
        Constant Field Values
      • CONFIG_EVICTION_POLICY

        static final java.lang.String CONFIG_EVICTION_POLICY
        See Also:
        Constant Field Values
      • CONFIG_FORCE_EXCLUSIVE_CALCULATION

        static final java.lang.String CONFIG_FORCE_EXCLUSIVE_CALCULATION
        See Also:
        Constant Field Values
    • Method Detail

      • setEnabled

        void setEnabled​(boolean enabled)
        enables/disables the cache.
        Parameters:
        enabled - true for enabling the cache, false otherwise.
      • isForceExclusiveComputation

        boolean isForceExclusiveComputation()
        checks if AbstractCacheUnit should synchronize load function.
      • clear

        void clear()
      • removeUnit

        void removeUnit​(AbstractCacheUnit unit)
        Removes a cache unit from this cache.
        Parameters:
        unit - the unit to be removed. note that the same of any unit with the same key is removed.
      • invalidate

        void invalidate​(java.lang.Object[] key,
                        int invalidationType)
        execute invalidation (not delayed to transaction end)
        Specified by:
        invalidate in interface InvalidationTarget
        Parameters:
        key - may be an incomplete key, for group invalidation
      • getAbstractCacheUnit

        AbstractCacheUnit getAbstractCacheUnit​(java.lang.String firstKeyElement,
                                               java.lang.String secondKeyElement,
                                               java.lang.String thirdKeyElement,
                                               PK fourthKeyElement)
        for performance optimizations: get a existing cache unit; the key of the cache unit must consist of exactly three elements
        Throws:
        CacheValueLoadException
        CacheRegionNotSpecifiedException
      • clearStats

        void clearStats()
        Clears the collected cache statistics.
      • statsEnabled

        boolean statsEnabled()
        Returns true if the statistics for the cache are enabled. This can be modified with the method setStatsEnabled(boolean). Collecting the statistics is very memory intensive - use clearStats() frequently.
        Returns:
        false otherwise.
      • setStatsEnabled

        void setStatsEnabled​(boolean enabled)
        Enables or disables the cache statistics.
        Parameters:
        enabled - true for enabling the statistics
      • enableStats

        void enableStats​(boolean enabled)
      • isStatsEmpty

        boolean isStatsEmpty()
        Returns true if no cache statistics are collected. addToStatistics(Object[], boolean) was not called yet)
        Returns:
        false otherwise
      • getStatistics

        java.util.Set<? extends CacheStatisticsEntry> getStatistics​(int upperBound,
                                                                    int lowerBound)
        Returns as Set the collected cache statistics. Each set entry is a DefaultCacheStatisticsEntry. With the parameters upperBound and lowerBound a reduced Set will be returned. DefaultCacheStatisticsEntry.getFactor() must be between upperBound and lowerBound.
        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.
      • getMaxAllowedSize

        int getMaxAllowedSize()
        The upper limit for the cache. this normally equals the setting 'cache.main' and is the number of cache entries that are allowed until the cache mechanism will remove the least recently used entries before adding new ones.
        Returns:
        the max allowed size
      • getMaxReachedSize

        int getMaxReachedSize()
        the maximum reached number of entries since creation of the cache. this is only reseted if Cache#clearCache() is called.
      • getSize

        int getSize()
      • getAddCount

        long getAddCount()
        Returns:
        how many entities where added to the cache since creation of the cache. This is reseted by calling clear() or clearStats().
      • getRemoveCount

        long getRemoveCount()
        Returns:
        how many entities where removed from the cache since creation of the cache. This is reseted by calling clear() or clearStats().
      • getGetCount

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

        long getMissCount()
        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 clear() or clearStats().
      • destroy

        void destroy()
        Method called by tennant to free resources before object is finalized
      • getTenant

        Tenant getTenant()
        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.
        Returns:
        the tenant or null if no tenant set
      • getTenantId

        java.lang.String getTenantId()