Class RedisResourceMetadataCache

  • All Implemented Interfaces:
    SearchableResourceMetadataCache, org.opennms.newts.cassandra.search.ResourceMetadataCache

    public class RedisResourceMetadataCache
    extends Object
    implements SearchableResourceMetadataCache
    A caching strategy that stores the ResourceMetadata in a Redis database. Can be used when the cache needs to be shared amongst several JVMs, or when persistence is required. Note that this cache will operate slower than the GuavaSearchableResourceMetadataCache since it requires network I/O and serialization/deserialization of the associated structures. However, this cache will also operate with significantly less memory. FST is used for serialization instead Java's default implementation.
    Author:
    jwhite
    • Constructor Summary

      Constructors 
      Constructor Description
      RedisResourceMetadataCache​(String hostname, Integer port, Integer numWriterThreads, com.codahale.metrics.MetricRegistry registry, org.opennms.newts.cassandra.search.ResourceIdSplitter resourceIdSplitter)  
    • Constructor Detail

      • RedisResourceMetadataCache

        @Inject
        public RedisResourceMetadataCache​(@Named("redis.hostname")
                                          String hostname,
                                          @Named("redis.port")
                                          Integer port,
                                          @Named("newts.writer_threads")
                                          Integer numWriterThreads,
                                          @Named("newtsMetricRegistry")
                                          com.codahale.metrics.MetricRegistry registry,
                                          org.opennms.newts.cassandra.search.ResourceIdSplitter resourceIdSplitter)
    • Method Detail

      • merge

        public void merge​(org.opennms.newts.api.Context context,
                          org.opennms.newts.api.Resource resource,
                          org.opennms.newts.cassandra.search.ResourceMetadata metadata)
        Specified by:
        merge in interface org.opennms.newts.cassandra.search.ResourceMetadataCache
      • get

        public com.google.common.base.Optional<org.opennms.newts.cassandra.search.ResourceMetadata> get​(org.opennms.newts.api.Context context,
                                                                                                        org.opennms.newts.api.Resource resource)
        Specified by:
        get in interface org.opennms.newts.cassandra.search.ResourceMetadataCache
      • delete

        public void delete​(org.opennms.newts.api.Context context,
                           org.opennms.newts.api.Resource resource)
        Specified by:
        delete in interface org.opennms.newts.cassandra.search.ResourceMetadataCache