Class CacheAccessImpl

    • Constructor Detail

      • CacheAccessImpl

        public CacheAccessImpl​(java.lang.String name,
                               int maxEntries)
        Standard constructor.
        Parameters:
        name - name of the cache region
        maxEntries - maximum number of entries
      • CacheAccessImpl

        public CacheAccessImpl​(java.lang.String name,
                               int maxEntries,
                               java.lang.String evictionPolicy)
        Standard constructor.
        Parameters:
        name - name of the cache region
        maxEntries - maximum number of entries
        evictionPolicy - eviction policy which is used
      • CacheAccessImpl

        public CacheAccessImpl​(java.lang.String name,
                               int maxEntries,
                               java.lang.String evictionPolicy,
                               boolean exclusiveComputation,
                               boolean statsEnabled)
        Standard constructor.
        Parameters:
        name - name of the cache region
        maxEntries - maximum number of entries
        evictionPolicy - eviction policy which is used
        exclusiveComputation - flag indicating if exclusive computation is used
        statsEnabled - flag indicating if statistics are stored or not
      • CacheAccessImpl

        public CacheAccessImpl​(java.lang.String name,
                               int maxEntries,
                               java.lang.String evictionPolicy,
                               boolean exclusiveComputation,
                               boolean statsEnabled,
                               java.lang.Long ttlSeconds)
        Standard constructor.
        Parameters:
        name - name of the cache region
        maxEntries - maximum number of entries
        evictionPolicy - eviction policy which is used
        exclusiveComputation - flag indicating if exclusive computation is used
        statsEnabled - flag indicating if statistics are stored or not
        ttlSeconds - time to live of the stored objects in seconds
    • Method Detail

      • setHandledTypes

        public void setHandledTypes​(java.lang.String[] handledTypes)
        Overrides:
        setHandledTypes in class EHCacheRegion
        Parameters:
        handledTypes - the handledTypes to set
      • get

        public java.lang.Object get​(java.lang.Object key)
        Description copied from interface: CacheAccess
        Gets an object from the cache for the given key.
        Specified by:
        get in interface CacheAccess
        Parameters:
        key - name of object which should be retrieved from the cache
        Returns:
        the object or null if the object could not be found in the cache
      • getKeys

        public java.util.Set<java.lang.Object> getKeys()
        Description copied from interface: CacheAccess
        Provide the keys of all objects, which are currently in the cache region.
        Specified by:
        getKeys in interface CacheAccess
        Returns:
        all keys.
      • put

        public void put​(java.lang.Object key,
                        java.lang.Object object)
                 throws SAPHybrisCacheException
        Description copied from interface: CacheAccess
        Puts an object into the cache region.
        Specified by:
        put in interface CacheAccess
        Parameters:
        key - key of object
        object - object which is put into the cache
        Throws:
        SAPHybrisCacheException - thrown if something goes wrong while adding an object to cache
      • putIfAbsent

        public void putIfAbsent​(java.lang.Object key,
                                java.lang.Object object)
                         throws SAPHybrisCacheException
        Description copied from interface: CacheAccess
        Puts an object into the cache region, only if no object with same key already exists.
        Specified by:
        putIfAbsent in interface CacheAccess
        Parameters:
        key - name of object
        object - object which is put into the cache
        Throws:
        SAPHybrisCacheException - thrown if something goes wrong while adding an object to cache
      • remove

        public void remove​(java.lang.Object key)
                    throws SAPHybrisCacheException
        Description copied from interface: CacheAccess
        Removes an object from the cache. The cached object cannot be longer used.
        Specified by:
        remove in interface CacheAccess
        Parameters:
        key - the name of the object which has to be removed from the cache
        Throws:
        SAPHybrisCacheException - if removing object fails
      • getNumObjects

        public int getNumObjects()
        Description copied from interface: CacheAccess
        Returns number of objects currently stored in the cache.
        Specified by:
        getNumObjects in interface CacheAccess
        Returns:
        number of objects currently stored in the cache.
      • getWithLoader

        public java.lang.Object getWithLoader​(java.lang.Object key,
                                              CacheValueLoader<?> loader)
        Description copied from interface: CacheAccess
        Gets an object from the cache using the loader to get the value.
        Specified by:
        getWithLoader in interface CacheAccess
        Parameters:
        key - the name of the object which has to loaded
        loader - the loader object which is used to load the value
        Returns:
        number of objects currently stored in the cache.