From d12ed674462d0c14887bb0e640bb6bde9deb8797 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 18 Sep 2019 12:58:03 +0200 Subject: [PATCH] User Cache is per Scope and not per ckan installation. Fixed this issue --- .../org/gcube/gcat/persistence/ckan/CKANUserCache.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java b/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java index c58f9ab..e60113c 100644 --- a/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java +++ b/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java @@ -22,7 +22,7 @@ public abstract class CKANUserCache { private static final MutableConfiguration userCacheConfiguration; - private static final Map> userCachePerCkanInstance; + private static final Map> userCachePerContext; static { CachingProvider provider = Caching.getCachingProvider(); @@ -32,18 +32,18 @@ public abstract class CKANUserCache { .setStoreByValue(false) .setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, 15))); - userCachePerCkanInstance = new HashMap>(); + userCachePerContext = new HashMap>(); } private CKANUserCache() { } public static CKANUser getCurrrentCKANUser() { - String ckanURL = CKANInstance.getInstance().getCKANURL(); - Cache userCache = userCachePerCkanInstance.get(ckanURL); + String context = ContextUtility.getCurrentContext(); + Cache userCache = userCachePerContext.get(context); if(userCache == null) { userCache = cacheManager.createCache(USERS_CACHE, userCacheConfiguration); - userCachePerCkanInstance.put(ckanURL, userCache); + userCachePerContext.put(context, userCache); } String gcubeUsername = ContextUtility.getUsername();