Class CachingTopicResolver<T extends Topic>

java.lang.Object
org.springframework.data.redis.listener.support.CachingTopicResolver<T>
All Implemented Interfaces:
TopicResolver<T>

public class CachingTopicResolver<T extends Topic> extends Object implements TopicResolver<T>
Caching TopicResolver variant using a TopicResolver for the actual resolution.

This resolver uses a ConcurrentLruCache to cache resolved topics.

Since:
4.1
Author:
Mark Paluch
  • Constructor Details

    • CachingTopicResolver

      public CachingTopicResolver(int cacheSize, TopicResolver<T> resolver)
      Create a new CachingTopicResolver with the given TopicResolver and cache size.
      Parameters:
      cacheSize - cache size.
      resolver - the actual resolver to resolve topics if not found in cache; must not be null.
  • Method Details

    • resolveTopic

      public T resolveTopic(String name)
      Description copied from interface: TopicResolver
      Resolve the given topic name.
      Specified by:
      resolveTopic in interface TopicResolver<T extends Topic>
      Parameters:
      name - the topic name to resolve.
      Returns:
      the resolved topic.