Package org.graylog2.plugin.lookup
Class LookupCache
java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.graylog2.plugin.lookup.LookupCache
- All Implemented Interfaces:
com.google.common.util.concurrent.Service
- Direct Known Subclasses:
CaffeineLookupCache
,NullCache
public abstract class LookupCache
extends com.google.common.util.concurrent.AbstractIdleService
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
LookupCache.Factory<T extends LookupCache>
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Constructor Summary
ModifierConstructorDescriptionprotected
LookupCache
(String id, String name, LookupCacheConfiguration config, com.codahale.metrics.MetricRegistry metricRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected abstract void
doStart()
protected abstract void
doStop()
long
Get the number of elements in this lookup cache.abstract LookupResult
get
(LookupCacheKey key, Callable<LookupResult> loader) getError()
abstract LookupResult
id()
void
Deprecated.void
incrHitCount
(long n) void
Deprecated.void
incrMissCount
(long n) void
Deprecated.void
incrTotalCount
(long n) com.codahale.metrics.Timer.Context
name()
abstract void
purge()
abstract void
purge
(LookupCacheKey purgeKey) protected void
void
protected void
shutDown()
protected void
startUp()
Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString
-
Constructor Details
-
LookupCache
protected LookupCache(String id, String name, LookupCacheConfiguration config, com.codahale.metrics.MetricRegistry metricRegistry)
-
-
Method Details
-
incrTotalCount
Deprecated. -
incrTotalCount
public void incrTotalCount(long n) -
incrHitCount
Deprecated. -
incrHitCount
public void incrHitCount(long n) -
incrMissCount
Deprecated. -
incrMissCount
public void incrMissCount(long n) -
lookupTimer
public com.codahale.metrics.Timer.Context lookupTimer() -
entryCount
public long entryCount()Get the number of elements in this lookup cache.- Returns:
- the number of elements in this lookup cache or
-1L
if the cache does not support counting entries
-
startUp
- Specified by:
startUp
in classcom.google.common.util.concurrent.AbstractIdleService
- Throws:
Exception
-
doStart
- Throws:
Exception
-
shutDown
- Specified by:
shutDown
in classcom.google.common.util.concurrent.AbstractIdleService
- Throws:
Exception
-
doStop
- Throws:
Exception
-
clearError
protected void clearError() -
getError
-
setError
-
id
-
setId
-
get
-
getIfPresent
-
purge
public abstract void purge() -
purge
-
getConfig
-
name
-