use composed key in multi tenant environment instead a cache per tenant (#981)

This commit is contained in:
Roland Praml
2017-05-20 12:35:34 +12:00
committed by Rob Bygrave
parent 0c1a9786a3
commit d3ea01b76e
12 changed files with 202 additions and 143 deletions
@@ -5,6 +5,7 @@ import io.ebean.cache.ServerCache;
import io.ebean.cache.ServerCacheFactory;
import io.ebean.cache.ServerCacheOptions;
import io.ebean.cache.ServerCacheType;
import io.ebean.config.CurrentTenantProvider;
/**
@@ -29,9 +30,9 @@ class DefaultServerCacheFactory implements ServerCacheFactory {
}
@Override
public ServerCache createCache(ServerCacheType type, String cacheKey, ServerCacheOptions cacheOptions) {
public ServerCache createCache(ServerCacheType type, String cacheKey, CurrentTenantProvider tenantProvider, ServerCacheOptions cacheOptions) {
DefaultServerCache cache = new DefaultServerCache(cacheKey, cacheOptions);
DefaultServerCache cache = new DefaultServerCache(cacheKey, tenantProvider, cacheOptions);
if (executor != null) {
cache.periodicTrim(executor);
}