User Cache is per Scope and not per ckan installation. Fixed this issue

migrating_to_smartgears_4
Luca Frosini 5 years ago
parent 3f542a763b
commit d12ed67446

@ -22,7 +22,7 @@ public abstract class CKANUserCache {
private static final MutableConfiguration<String,CKANUser> userCacheConfiguration;
private static final Map<String,Cache<String,CKANUser>> userCachePerCkanInstance;
private static final Map<String,Cache<String,CKANUser>> 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<String,Cache<String,CKANUser>>();
userCachePerContext = new HashMap<String,Cache<String,CKANUser>>();
}
private CKANUserCache() {
}
public static CKANUser getCurrrentCKANUser() {
String ckanURL = CKANInstance.getInstance().getCKANURL();
Cache<String,CKANUser> userCache = userCachePerCkanInstance.get(ckanURL);
String context = ContextUtility.getCurrentContext();
Cache<String,CKANUser> 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();

Loading…
Cancel
Save