Interface CacheAccess

All Known Implementing Classes:
CacheAccessImpl, CacheAccessInactiveImpl, CacheAccessMockImpl, MockCacheAccess

public interface CacheAccess
The CacheAccess provides the direct access to a cache region. This class should only be used for the migration of existing SAP application modules. For other caching scenarios use the Hybris Cache Framework.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all elements from cache.
    get(Object key)
    Gets an object from the cache for the given key.
    Provide the keys of all objects, which are currently in the cache region.
    int
    Returns number of objects currently stored in the cache.
    getWithLoader(Object key, de.hybris.platform.regioncache.CacheValueLoader<?> loader)
    Gets an object from the cache using the loader to get the value.
    void
    put(Object key, Object object)
    Puts an object into the cache region.
    void
    putIfAbsent(Object name, Object object)
    Puts an object into the cache region, only if no object with same key already exists.
    void
    Removes an object from the cache.
  • Method Details

    • get

      Object get(Object key)
      Gets an object from the cache for the given key.
      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

      Set<Object> getKeys()
      Provide the keys of all objects, which are currently in the cache region.
      Returns:
      all keys.
    • put

      void put(Object key, Object object) throws SAPHybrisCacheException
      Puts an object into the cache region.
      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

      void putIfAbsent(Object name, Object object) throws SAPHybrisCacheException
      Puts an object into the cache region, only if no object with same key already exists.
      Parameters:
      name - 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

      void remove(Object key) throws SAPHybrisCacheException
      Removes an object from the cache. The cached object cannot be longer used.
      Parameters:
      key - the name of the object which has to be removed from the cache
      Throws:
      SAPHybrisCacheException - if removing object fails
    • getNumObjects

      int getNumObjects()
      Returns number of objects currently stored in the cache.
      Returns:
      number of objects currently stored in the cache.
    • getWithLoader

      Object getWithLoader(Object key, de.hybris.platform.regioncache.CacheValueLoader<?> loader)
      Gets an object from the cache using the loader to get the value.
      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.
    • clearCache

      void clearCache()
      Removes all elements from cache.