001package com.avaje.ebean.cache;
002
003import com.avaje.ebean.EbeanServer;
004
005/**
006 * Defines method for constructing caches for beans and queries.
007 */
008public interface ServerCacheFactory {
009
010  /**
011   * Just after the ServerCacheFactory is constructed this method is called
012   * passing the EbeanServer.
013   * <p>
014   * This is so that a cache implementation can utilise the EbeanServer to
015   * populate itself or use the BackgroundExecutor service to schedule periodic
016   * cache trimming/cleanup.
017   * </p>
018   */
019  void init(EbeanServer ebeanServer);
020
021  /**
022   * Create the cache for the given type with options.
023   */
024  ServerCache createCache(String cacheKey, ServerCacheOptions cacheOptions);
025
026}