001package io.ebean.cache; 002 003import io.ebean.meta.MetricVisitor; 004 005/** 006 * Defines method for constructing caches for beans and queries. 007 */ 008public interface ServerCacheFactory { 009 010 /** 011 * Visit the metrics for the cache. 012 */ 013 default void visit(MetricVisitor visitor) { 014 // do nothing by default 015 } 016 017 /** 018 * Create the cache for the given type with options. 019 */ 020 ServerCache createCache(ServerCacheConfig config); 021 022 /** 023 * Return a ServerCacheNotify that we will send ServerCacheNotification events to. 024 * <p> 025 * This is used if a ServerCacheNotifyPlugin is not supplied. 026 * </p> 027 * 028 * @param listener The listener that should be used to process the notification events. 029 */ 030 ServerCacheNotify createCacheNotify(ServerCacheNotify listener); 031}