001package io.ebean.cache; 002 003import io.ebean.config.CurrentTenantProvider; 004 005/** 006 * Configuration used to create ServerCache instances. 007 */ 008public class ServerCacheConfig { 009 010 private final ServerCacheType type; 011 private final String cacheKey; 012 private final ServerCacheOptions cacheOptions; 013 private final CurrentTenantProvider tenantProvider; 014 private final QueryCacheEntryValidate queryCacheEntryValidate; 015 016 public ServerCacheConfig(ServerCacheType type, String cacheKey, ServerCacheOptions cacheOptions, CurrentTenantProvider tenantProvider, QueryCacheEntryValidate queryCacheEntryValidate) { 017 this.type = type; 018 this.cacheKey = cacheKey; 019 this.cacheOptions = cacheOptions; 020 this.tenantProvider = tenantProvider; 021 this.queryCacheEntryValidate = queryCacheEntryValidate; 022 } 023 024 /** 025 * Return the cache type. 026 */ 027 public ServerCacheType getType() { 028 return type; 029 } 030 031 /** 032 * Return the name of the cache. 033 */ 034 public String getCacheKey() { 035 return cacheKey; 036 } 037 038 /** 039 * Return the tuning options. 040 */ 041 public ServerCacheOptions getCacheOptions() { 042 return cacheOptions; 043 } 044 045 /** 046 * Return the current tenant provider. 047 */ 048 public CurrentTenantProvider getTenantProvider() { 049 return tenantProvider; 050 } 051 052 /** 053 * Return the service that provides validation for query cache entries. 054 */ 055 public QueryCacheEntryValidate getQueryCacheEntryValidate() { 056 return queryCacheEntryValidate; 057 } 058 059 /** 060 * Return true if the cache is a query cache. 061 */ 062 public boolean isQueryCache() { 063 return type == ServerCacheType.QUERY; 064 } 065}