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:
AccountCacheImpl.AccountCacheModule
,ChangesByProjectCacheImpl.Module
,ExternalIdCacheImpl.ExternalIdCacheModule
,MailSoySauceModule
,SearchingChangeCacheImpl.SearchingChangeCacheImplModule
Miniature DSL to support binding
Cache
instances in Guice.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <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> Declare a named in-memory cache.protected <K,
V> CacheBinding <K, V> 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) Declare a named in-memory/on-disk cache.protected <K,
V> PersistentCacheBinding <K, V> Declare a named in-memory/on-disk cache.protected <K,
V> PersistentCacheBinding <K, V> 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, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
Field Details
-
MEMORY_MODULE
- See Also:
-
PERSISTENT_MODULE
- See Also:
-
-
Constructor Details
-
CacheModule
public CacheModule()
-
-
Method Details
-
cache
@CanIgnoreReturnValue 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
@CanIgnoreReturnValue 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
@CanIgnoreReturnValue 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, 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) 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.
-