Class LoomSpringCache

java.lang.Object
com.loomcache.springboot.cache.LoomSpringCache
All Implemented Interfaces:
org.springframework.cache.Cache

public final class LoomSpringCache extends Object implements org.springframework.cache.Cache
Spring Cache implementation backed by a LoomCache distributed map.

Each LoomSpringCache instance wraps a single named distributed map obtained from the LoomCache client.

Since:
1.0
See Also:
  • Constructor Details

    • LoomSpringCache

      public LoomSpringCache(String name, LoomCache loomClient)
      Construct a new Spring Cache backed by a LoomCache distributed map.
      Parameters:
      name - the cache name (used as the distributed map name)
      loomClient - the LoomCache client instance
      Throws:
      IllegalArgumentException - if name is null or blank
      NullPointerException - if loomClient is null
    • LoomSpringCache

      public LoomSpringCache(String name, LoomCache loomClient, Duration defaultTtl)
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface org.springframework.cache.Cache
    • getNativeCache

      public LoomCache getNativeCache()
      Specified by:
      getNativeCache in interface org.springframework.cache.Cache
    • get

      public @Nullable org.springframework.cache.Cache.ValueWrapper get(Object key)
      Specified by:
      get in interface org.springframework.cache.Cache
    • get

      public <T> @Nullable T get(Object key, @Nullable Class<T> type)
      Specified by:
      get in interface org.springframework.cache.Cache
    • get

      public <T> @Nullable T get(Object key, Callable<T> valueLoader)
      Specified by:
      get in interface org.springframework.cache.Cache
    • put

      public void put(Object key, @Nullable Object value)
      Specified by:
      put in interface org.springframework.cache.Cache
    • putIfAbsent

      public @Nullable org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, @Nullable Object value)
      Specified by:
      putIfAbsent in interface org.springframework.cache.Cache
    • evict

      public void evict(Object key)
      Specified by:
      evict in interface org.springframework.cache.Cache
    • clear

      public void clear()
      Specified by:
      clear in interface org.springframework.cache.Cache