001package io.ebean.cache; 002 003/** 004 * The cache service for server side caching of beans and query results. 005 */ 006public interface ServerCacheManager { 007 008 /** 009 * Return true if the L2 caching is local. 010 * <p> 011 * Local L2 caching means that the cache updates should occur in foreground 012 * rather than background processing. 013 * </p> 014 */ 015 boolean isLocalL2Caching(); 016 017 /** 018 * Return the cache for mapping natural keys to id values. 019 */ 020 ServerCache getNaturalKeyCache(Class<?> beanType); 021 022 /** 023 * Return the cache for beans of a particular type. 024 */ 025 ServerCache getBeanCache(Class<?> beanType); 026 027 /** 028 * Return the cache for associated many properties of a bean type. 029 */ 030 ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName); 031 032 /** 033 * Return the cache for query results of a particular type of bean. 034 */ 035 ServerCache getQueryCache(Class<?> beanType); 036 037 /** 038 * This clears both the bean and query cache for a given type. 039 */ 040 void clear(Class<?> beanType); 041 042 /** 043 * Clear all the caches. 044 */ 045 void clearAll(); 046 047 /** 048 * Clear all the local caches. 049 * 050 * This is used when the L2 Cache is based on clustered near-caches (Like Ebean-K8s-L2Cache). 051 * It is not used when the L2 cache is a distributed cache such as HazelCast or Ignite etc. 052 */ 053 void clearAllLocal(); 054 055 /** 056 * Clear the local caches for this bean type. 057 * 058 * This is used when the L2 Cache is based on clustered near-caches (Like Ebean-K8s-L2Cache). 059 * It is not used when the L2 cache is a distributed cache such as HazelCast or Ignite etc. 060 */ 061 void clearLocal(Class<?> beanType); 062}