Interface SpiCacheManager

All Known Implementing Classes:
DefaultServerCacheManager

public interface SpiCacheManager
The cache service for server side caching of beans and query results.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<io.ebean.cache.ServerCacheRegion>
    Return all the regions.
    void
    clear(Class<?> beanType)
    Clear the caches for the given bean type.
    void
    Clear all the caches.
    void
    Clear all local caches.
    void
    clearLocal(Class<?> beanType)
    Clear local caches for the given bean type.
    void
    clearTenant(Object tenantId)
    Remove all cache entries belonging to the given tenant.
    io.ebean.cache.ServerCache
    getBeanCache(Class<?> beanType)
    Return the cache for beans of a particular type.
    io.ebean.cache.ServerCache
    getCollectionIdsCache(Class<?> beanType, String propertyName)
    Return the cache for associated many properties of a bean type.
    io.ebean.cache.ServerCache
    Return the cache for mapping natural keys to id values.
    io.ebean.cache.ServerCache
    getQueryCache(Class<?> beanType)
    Return the cache for query results of a particular type of bean.
    getRegion(String region)
    Return the cache region.
    boolean
    Return true if the L2 caching is local.
    boolean
    Returns true if this cache manager runs in tenant-partitioned mode.
    void
    setAllRegionsEnabled(boolean enabled)
    Enable or disable all cache regions.
    void
    Set the regions that are enabled.
    void
    visitMetrics(io.ebean.meta.MetricVisitor visitor)
    Visit and collect the metrics.
  • Method Details

    • visitMetrics

      void visitMetrics(io.ebean.meta.MetricVisitor visitor)
      Visit and collect the metrics.
    • isLocalL2Caching

      boolean isLocalL2Caching()
      Return true if the L2 caching is local.

      Local L2 caching means that the cache updates should occur in foreground rather than background processing.

    • allRegions

      List<io.ebean.cache.ServerCacheRegion> allRegions()
      Return all the regions.
    • setEnabledRegions

      void setEnabledRegions(String regions)
      Set the regions that are enabled.
      Parameters:
      regions - A single region name or a comma delimited list of region names.
    • setAllRegionsEnabled

      void setAllRegionsEnabled(boolean enabled)
      Enable or disable all cache regions.
    • getRegion

      SpiCacheRegion getRegion(String region)
      Return the cache region. We can enable L2 caching by region.
    • getNaturalKeyCache

      io.ebean.cache.ServerCache getNaturalKeyCache(Class<?> beanType)
      Return the cache for mapping natural keys to id values.
    • getBeanCache

      io.ebean.cache.ServerCache getBeanCache(Class<?> beanType)
      Return the cache for beans of a particular type.
    • getCollectionIdsCache

      io.ebean.cache.ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName)
      Return the cache for associated many properties of a bean type.
    • getQueryCache

      io.ebean.cache.ServerCache getQueryCache(Class<?> beanType)
      Return the cache for query results of a particular type of bean.
    • clear

      void clear(Class<?> beanType)
      Clear the caches for the given bean type.
    • clearAll

      void clearAll()
      Clear all the caches.
    • clearAllLocal

      void clearAllLocal()
      Clear all local caches.
    • clearLocal

      void clearLocal(Class<?> beanType)
      Clear local caches for the given bean type.
    • isTenantPartitionedCache

      boolean isTenantPartitionedCache()
      Returns true if this cache manager runs in tenant-partitioned mode. In this mode caches are namespaced per tenant to improve cache-hit ratio.
    • clearTenant

      void clearTenant(Object tenantId)
      Remove all cache entries belonging to the given tenant. Call this when a tenant is deactivated to prevent unbounded memory growth in tenant-partitioned mode.