Interface CachingManager

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean enabled​(java.lang.String cacheName)
      Checks if the requested cache is enabled or not.
      <T,​E extends java.lang.Exception>
      T
      get​(java.lang.String cacheName, java.io.Serializable key, CheckedSupplier<T,​E> supplier)
      Returns an item from a cache.
      CacheInfo info​(java.lang.String cacheName)
      Retrieves cache usage information.
      <T extends java.io.Serializable>
      java.util.List<T>
      keys​(java.lang.String cacheName)
      Returns the list of keys from elements present in a cache.
      void put​(java.lang.String cacheName, java.io.Serializable key, java.lang.Object val)
      Puts an item on a cache.
      void remove​(java.lang.String cacheName, java.io.Serializable key)
      Removes an item from a cache.
      void shutdown()
      Shuts down the underlying cache manager
    • Method Detail

      • shutdown

        void shutdown()
        Shuts down the underlying cache manager
      • enabled

        boolean enabled​(java.lang.String cacheName)
        Checks if the requested cache is enabled or not.
        Parameters:
        cacheName - The cache to be queried.
        Returns:
        true if the cache is enabled, false otherwise.
      • info

        CacheInfo info​(java.lang.String cacheName)
        Retrieves cache usage information.
        Parameters:
        cacheName - The cache to be queried.
        Returns:
        cache usage information, or null if the requested cache is not enabled.
      • keys

        <T extends java.io.Serializable> java.util.List<T> keys​(java.lang.String cacheName)
        Returns the list of keys from elements present in a cache.
        Parameters:
        cacheName - The cache to be queried.
        Returns:
        list of keys from elements present in a cache.
      • get

        <T,​E extends java.lang.Exception> T get​(java.lang.String cacheName,
                                                      java.io.Serializable key,
                                                      CheckedSupplier<T,​E> supplier)
                                               throws E extends java.lang.Exception
        Returns an item from a cache. If it is not found on the cache, try to retrieve from the provided supplier. If found there, put the value in the cache, and return it. Otherwise, return null.
        Parameters:
        cacheName - The cache in which the item lives.
        key - item's identifier.
        supplier - if the element is not cached, try to retrieve from the cached system.
        Returns:
        The requested item or null if either the cache is not enabled or the item is not present on the cache / cached service.
        Throws:
        E - the supplier may throw a checked exception, which is propagated upwards.
        E extends java.lang.Exception
      • put

        void put​(java.lang.String cacheName,
                 java.io.Serializable key,
                 java.lang.Object val)
        Puts an item on a cache.
        Parameters:
        cacheName - The cache in which the item will live.
        key - item's identifier.
        val - item to insert in the cache.
      • remove

        void remove​(java.lang.String cacheName,
                    java.io.Serializable key)
        Removes an item from a cache.
        Parameters:
        cacheName - The cache in which the item to be removed lives.
        key - item's identifier.