Interface CacheAccess

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clearCache()
      Removes all elements from cache.
      java.lang.Object get​(java.lang.Object key)
      Gets an object from the cache for the given key.
      java.util.Set<java.lang.Object> getKeys()
      Provide the keys of all objects, which are currently in the cache region.
      int getNumObjects()
      Returns number of objects currently stored in the cache.
      java.lang.Object getWithLoader​(java.lang.Object key, CacheValueLoader<?> loader)
      Gets an object from the cache using the loader to get the value.
      void put​(java.lang.Object key, java.lang.Object object)
      Puts an object into the cache region.
      void putIfAbsent​(java.lang.Object name, java.lang.Object object)
      Puts an object into the cache region, only if no object with same key already exists.
      void remove​(java.lang.Object key)
      Removes an object from the cache.
    • Method Detail

      • get

        java.lang.Object get​(java.lang.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

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

        void put​(java.lang.Object key,
                 java.lang.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​(java.lang.Object name,
                         java.lang.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​(java.lang.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

        java.lang.Object getWithLoader​(java.lang.Object key,
                                       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.