001package com.avaje.ebean.cache; 002 003import com.avaje.ebean.EbeanServer; 004 005/** 006 * The cache service for server side caching of beans and query results. 007 */ 008public interface ServerCacheManager { 009 010 /** 011 * This method is called just after the construction of the 012 * ServerCacheManager. 013 * <p> 014 * The EbeanServer is provided so that cache implementations can make use of 015 * EbeanServer and BackgroundExecutor for automatically populating and 016 * background trimming of the cache. 017 * </p> 018 */ 019 void init(EbeanServer server); 020 021 void setCaching(Class<?> beanType, boolean useCache); 022 023 /** 024 * Return true if there is an active bean cache for this type of bean. 025 */ 026 boolean isBeanCaching(Class<?> beanType); 027 028 /** 029 * Return the cache for mapping natural keys to id values. 030 */ 031 ServerCache getNaturalKeyCache(Class<?> beanType); 032 033 /** 034 * Return the cache for beans of a particular type. 035 */ 036 ServerCache getBeanCache(Class<?> beanType); 037 038 ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName); 039 040 /** 041 * Return the cache for query results of a particular type of bean. 042 */ 043 ServerCache getQueryCache(Class<?> beanType); 044 045 /** 046 * This clears both the bean and query cache for a given type. 047 */ 048 void clear(Class<?> beanType); 049 050 /** 051 * Clear all the caches. 052 */ 053 void clearAll(); 054 055}