Package com.google.gerrit.server.cache
Class CacheModule
- java.lang.Object
-
- com.google.inject.AbstractModule
-
- com.google.gerrit.extensions.config.FactoryModule
-
- com.google.gerrit.server.cache.CacheModule
-
- All Implemented Interfaces:
com.google.inject.Module
- Direct Known Subclasses:
ExternalIdCacheModule
,RulesCache.RulesCacheModule
,SearchingChangeCacheImpl.SearchingChangeCacheImplModule
public abstract class CacheModule extends FactoryModule
Miniature DSL to support bindingCache
instances in Guice.
-
-
Field Summary
Fields Modifier and Type Field Description static String
MEMORY_MODULE
static String
PERSISTENT_MODULE
-
Constructor Summary
Constructors Constructor Description CacheModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <K,V>
CacheBinding<K,V>cache(String name, com.google.inject.TypeLiteral<K> keyType, com.google.inject.TypeLiteral<V> valType)
Declare a named in-memory cache.protected <K,V>
CacheBinding<K,V>cache(String name, Class<K> keyType, com.google.inject.TypeLiteral<V> valType)
Declare a named in-memory cache.protected <K,V>
CacheBinding<K,V>cache(String name, Class<K> keyType, Class<V> valType)
Declare a named in-memory cache.protected <K,V>
PersistentCacheBinding<K,V>persist(String name, com.google.inject.TypeLiteral<K> keyType, com.google.inject.TypeLiteral<V> valType, CacheBackend backend)
Declare a named in-memory/on-disk cache.protected <K,V>
PersistentCacheBinding<K,V>persist(String name, Class<K> keyType, com.google.inject.TypeLiteral<V> valType)
Declare a named in-memory/on-disk cache.protected <K,V>
PersistentCacheBinding<K,V>persist(String name, Class<K> keyType, Class<V> valType)
Declare a named in-memory/on-disk cache.protected <K,V>
PersistentCacheBinding<K,V>persist(String name, Class<K> keyType, Class<V> valType, CacheBackend backend)
Declare a named in-memory/on-disk cache.-
Methods inherited from class com.google.gerrit.extensions.config.FactoryModule
factory
-
Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
-
-
-
Field Detail
-
MEMORY_MODULE
public static final String MEMORY_MODULE
- See Also:
- Constant Field Values
-
PERSISTENT_MODULE
public static final String PERSISTENT_MODULE
- See Also:
- Constant Field Values
-
-
Method Detail
-
cache
protected <K,V> CacheBinding<K,V> cache(String name, Class<K> keyType, Class<V> valType)
Declare a named in-memory cache.- Type Parameters:
K
- type of key used to lookup entries.V
- type of value stored by the cache.- Returns:
- binding to describe the cache.
-
cache
protected <K,V> CacheBinding<K,V> cache(String name, Class<K> keyType, com.google.inject.TypeLiteral<V> valType)
Declare a named in-memory cache.- Type Parameters:
K
- type of key used to lookup entries.V
- type of value stored by the cache.- Returns:
- binding to describe the cache.
-
cache
protected <K,V> CacheBinding<K,V> cache(String name, com.google.inject.TypeLiteral<K> keyType, com.google.inject.TypeLiteral<V> valType)
Declare a named in-memory cache.- Type Parameters:
K
- type of key used to lookup entries.V
- type of value stored by the cache.- Returns:
- binding to describe the cache.
-
persist
protected <K,V> PersistentCacheBinding<K,V> persist(String name, Class<K> keyType, Class<V> valType)
Declare a named in-memory/on-disk cache.- Type Parameters:
K
- type of key used to lookup entries.V
- type of value stored by the cache.- Returns:
- binding to describe the cache.
-
persist
protected <K,V> PersistentCacheBinding<K,V> persist(String name, Class<K> keyType, Class<V> valType, CacheBackend backend)
Declare a named in-memory/on-disk cache.- Type Parameters:
K
- type of key used to lookup entries.V
- type of value stored by the cache.- Parameters:
backend
- cache backend.- Returns:
- binding to describe the cache.
-
persist
protected <K,V> PersistentCacheBinding<K,V> persist(String name, Class<K> keyType, com.google.inject.TypeLiteral<V> valType)
Declare a named in-memory/on-disk cache.- Type Parameters:
K
- type of key used to lookup entries.V
- type of value stored by the cache.- Returns:
- binding to describe the cache.
-
persist
protected <K,V> PersistentCacheBinding<K,V> persist(String name, com.google.inject.TypeLiteral<K> keyType, com.google.inject.TypeLiteral<V> valType, CacheBackend backend)
Declare a named in-memory/on-disk cache.- Type Parameters:
K
- type of key used to lookup entries.V
- type of value stored by the cache.- Returns:
- binding to describe the cache.
-
-