public class RedisResourceMetadataCache extends Object implements SearchableResourceMetadataCache
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.Constructor and Description |
---|
RedisResourceMetadataCache(String hostname,
Integer port,
Integer numWriterThreads,
com.codahale.metrics.MetricRegistry registry,
org.opennms.newts.cassandra.search.ResourceIdSplitter resourceIdSplitter) |
Modifier and Type | Method and Description |
---|---|
void |
delete(org.opennms.newts.api.Context context,
org.opennms.newts.api.Resource resource) |
com.google.common.base.Optional<org.opennms.newts.cassandra.search.ResourceMetadata> |
get(org.opennms.newts.api.Context context,
org.opennms.newts.api.Resource resource) |
List<String> |
getResourceIdsWithPrefix(org.opennms.newts.api.Context context,
String resourceIdPrefix) |
void |
merge(org.opennms.newts.api.Context context,
org.opennms.newts.api.Resource resource,
org.opennms.newts.cassandra.search.ResourceMetadata metadata) |
@Inject public RedisResourceMetadataCache(@Named(value="redis.hostname") String hostname, @Named(value="redis.port") Integer port, @Named(value="newts.writer_threads") Integer numWriterThreads, @Named(value="newtsMetricRegistry") com.codahale.metrics.MetricRegistry registry, org.opennms.newts.cassandra.search.ResourceIdSplitter resourceIdSplitter)
public void merge(org.opennms.newts.api.Context context, org.opennms.newts.api.Resource resource, org.opennms.newts.cassandra.search.ResourceMetadata metadata)
merge
in interface org.opennms.newts.cassandra.search.ResourceMetadataCache
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)
get
in interface org.opennms.newts.cassandra.search.ResourceMetadataCache
public void delete(org.opennms.newts.api.Context context, org.opennms.newts.api.Resource resource)
delete
in interface org.opennms.newts.cassandra.search.ResourceMetadataCache
public List<String> getResourceIdsWithPrefix(org.opennms.newts.api.Context context, String resourceIdPrefix)
getResourceIdsWithPrefix
in interface SearchableResourceMetadataCache
Copyright © 2021. All rights reserved.