001package com.avaje.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 true if there is an active bean cache for this type of bean.
019   */
020  boolean isBeanCaching(Class<?> beanType);
021
022  /**
023   * Return the cache for mapping natural keys to id values.
024   */
025  ServerCache getNaturalKeyCache(Class<?> beanType);
026
027  /**
028   * Return the cache for beans of a particular type.
029   */
030  ServerCache getBeanCache(Class<?> beanType);
031
032  /**
033   * Return the cache for associated many properties of a bean type.
034   */
035  ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName);
036
037  /**
038   * Return the cache for query results of a particular type of bean.
039   */
040  ServerCache getQueryCache(Class<?> beanType);
041
042  /**
043   * This clears both the bean and query cache for a given type.
044   */
045  void clear(Class<?> beanType);
046
047  /**
048   * Clear all the caches.
049   */
050  void clearAll();
051
052}