public class RedisCountStorage extends Object implements CountStorage
Stores a cache of counts so that we can know which Types to shard when they have too many
instances.
| Modifier and Type | Method and Description |
|---|---|
static RedisCountStorage |
create(redis.clients.util.Pool<redis.clients.jedis.Jedis> jedisPool,
com.codahale.metrics.MetricRegistry metricRegistry) |
long |
getCount(String key)
Gets the count for the specified key.
|
long |
getInstanceCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId)
Get the instance count for a specific concept.
|
static String |
getKeyNumInstances(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId)
All the valid keys which map to values in the redis cache
|
static String |
getKeyNumShards(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId) |
long |
getShardCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId)
Get the shard count for a specific concept.
|
long |
incrementCount(String key,
long incrementBy)
Adjusts the count for a specific key.
|
long |
incrementInstanceCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId,
long incrementBy)
Adjusts the count for a specific concept.
|
long |
incrementShardCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId,
long incrementBy)
Adjusts the shard count for a specific concept.
|
public static RedisCountStorage create(redis.clients.util.Pool<redis.clients.jedis.Jedis> jedisPool, com.codahale.metrics.MetricRegistry metricRegistry)
public long incrementInstanceCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId,
long incrementBy)
CountStorageincrementInstanceCount in interface CountStorageincrementBy - the number to adjust the key bypublic long incrementShardCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId,
long incrementBy)
CountStorageincrementShardCount in interface CountStorageincrementBy - the number to adjust the key bypublic long getInstanceCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId)
CountStoragegetInstanceCount in interface CountStoragepublic long getShardCount(ai.grakn.Keyspace keyspace,
ai.grakn.concept.ConceptId conceptId)
CountStoragegetShardCount in interface CountStoragepublic long incrementCount(String key, long incrementBy)
key - the key of the value to adjustincrementBy - the number to adjust the key bypublic long getCount(String key)
key - the key stored in redispublic static String getKeyNumInstances(ai.grakn.Keyspace keyspace, ai.grakn.concept.ConceptId conceptId)
public static String getKeyNumShards(ai.grakn.Keyspace keyspace, ai.grakn.concept.ConceptId conceptId)
Copyright © 2018 Grakn Labs Ltd. All rights reserved.