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

public abstract class CacheModule extends FactoryModule
Miniature DSL to support binding Cache instances in Guice.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    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)
    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.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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.