public JCache(URL url) { String type = url.getParameter("jcache"); CacheManager cacheManager = type == null || type.length() == 0 ? Caching.getCacheManager() : Caching.getCacheManager(type); CacheBuilder<Object, Object> cacheBuilder = cacheManager.createCacheBuilder(url.getServiceKey()); this.store = cacheBuilder.build(); }
public JCache(URL url) { String type = url.getParameter("jcache"); CacheManager cacheManager = type == null || type.length() == 0 ? Caching.getCacheManager() : Caching.getCacheManager(type); CacheBuilder<Object, Object> cacheBuilder = cacheManager.createCacheBuilder(url.getServiceKey()); this.store = cacheBuilder.build(); }
cacheBuilder = cacheManager.<Integer, EntitlementEngine>createCacheBuilder(ENTITLEMENT_ENGINE_CACHE). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, entitlementEngineCachingInterval)).
cacheBuilder = cacheManager.<Integer, EntitlementEngine>createCacheBuilder(ENTITLEMENT_ENGINE_CACHE). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, entitlementEngineCachingInterval)).
protected static Cache getGatewayKeyCache() { String apimGWCacheExpiry = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration(). getFirstProperty(APIConstants.TOKEN_CACHE_EXPIRY); if (!isGatewayKeyCacheInitialized && apimGWCacheExpiry != null) { isGatewayKeyCacheInitialized = true; return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER) .createCacheBuilder(APIConstants.GATEWAY_KEY_CACHE_NAME). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, Long.parseLong( apimGWCacheExpiry))) . setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, Long.parseLong( apimGWCacheExpiry))) .setStoreByValue(false).build(); } else { return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER) .getCache(APIConstants.GATEWAY_KEY_CACHE_NAME); } }
private static Cache getKeyManagerCache(){ String apimKeyCacheExpiry = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService(). getAPIManagerConfiguration().getFirstProperty(APIConstants.TOKEN_CACHE_EXPIRY); if(!isKeyCacheInistialized && apimKeyCacheExpiry != null ) { isKeyCacheInistialized = true; return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER). createCacheBuilder(APIConstants.KEY_CACHE_NAME) .setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, Long.parseLong(apimKeyCacheExpiry))) .setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, Long.parseLong(apimKeyCacheExpiry))).setStoreByValue(false).build(); } else{ return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER). getCache(APIConstants.KEY_CACHE_NAME); } }
private void initCaches() { String sessionCacheTimeoutPropertyValue = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration(). getFirstProperty(AppMConstants.GATEWAY_SESSION_TIMEOUT); sessionCacheTimeout = DEFAULT_GATEWAY_SESSION_TIMEOUT; if(sessionCacheTimeoutPropertyValue != null){ sessionCacheTimeout = Long.parseLong(sessionCacheTimeoutPropertyValue); } Caching.getCacheManager(AppMConstants.GATEWAY_CACHE_MANAGER). createCacheBuilder(AppMConstants.GATEWAY_SESSION_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setStoreByValue(false).build(); Caching.getCacheManager(AppMConstants.GATEWAY_CACHE_MANAGER). createCacheBuilder(AppMConstants.GATEWAY_SESSION_INDEX_MAPPING_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setStoreByValue(false).build(); }
public Cache<String, String> getSessionIndexMappingCache(){ try { CacheBuilder cacheBuilder = Caching.getCacheManager(AppMConstants.GATEWAY_CACHE_MANAGER). createCacheBuilder(AppMConstants.GATEWAY_SESSION_INDEX_MAPPING_CACHE); return cacheBuilder.setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setStoreByValue(false).build(); } catch (CacheException e) { //Cache already exists return Caching.getCacheManager(AppMConstants.GATEWAY_CACHE_MANAGER).getCache(AppMConstants.GATEWAY_SESSION_INDEX_MAPPING_CACHE); } }
public Cache<String, Session> getSessionCache(){ try { CacheBuilder cacheBuilder = Caching.getCacheManager(AppMConstants.GATEWAY_CACHE_MANAGER). createCacheBuilder(AppMConstants.GATEWAY_SESSION_CACHE); return cacheBuilder.setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, sessionCacheTimeout)). setStoreByValue(false).build(); } catch (CacheException e) { //Cache already exists return Caching.getCacheManager(AppMConstants.GATEWAY_CACHE_MANAGER).getCache(AppMConstants.GATEWAY_SESSION_CACHE); } } }
private static Cache<Integer, SharedMemorySubscriptionStorage> getTenantIDInMemorySubscriptionStorageCache() { if (cacheInit) { return Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER) .getCache(SharedMemoryCacheConstants.TENANT_ID_INMEMORY_SUBSCRIPTION_STORAGE_CACHE); } else { CacheManager cacheManager = Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER); cacheInit = true; log.info("Tenant ID InMemory Subscription Storage Cache Initialized"); return cacheManager.<Integer, SharedMemorySubscriptionStorage>createCacheBuilder( SharedMemoryCacheConstants.TENANT_ID_INMEMORY_SUBSCRIPTION_STORAGE_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setStoreByValue(false).build(); } }
if (cacheBuilder == null) { cacheManager.removeCache(Entitlement_CACHE_NAME); this.cacheBuilder = cacheManager.<K, V>createCacheBuilder(Entitlement_CACHE_NAME). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, cacheTimeout)).
public static Cache getAPIContextCache() { CacheManager contextCacheManager = Caching.getCacheManager(AppMConstants.API_CONTEXT_CACHE_MANAGER) .getCache(AppMConstants.API_CONTEXT_CACHE) .getCacheManager(); if (!isContextCacheInitialized) { isContextCacheInitialized = true; return contextCacheManager.<String, Boolean> createCacheBuilder(AppMConstants.API_CONTEXT_CACHE_MANAGER) .setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration( TimeUnit.DAYS, AppMConstants.API_CONTEXT_CACHE_EXPIRY_TIME_IN_DAYS)) .setStoreByValue(false).build(); } else { return Caching.getCacheManager(AppMConstants.API_CONTEXT_CACHE_MANAGER) .getCache(AppMConstants.API_CONTEXT_CACHE); } }
public static Cache<Integer, SharedMemoryMatchingManager> getInMemoryMatchingCache() { if (cacheInit) { return Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER) .getCache(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE); } else { CacheManager cacheManager = Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER); cacheInit = true; return cacheManager.<Integer, SharedMemoryMatchingManager>createCacheBuilder(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setStoreByValue(false).build(); } }
public static Cache<String, String> getSubscriptionIDTopicNameCache() { if (tenantIDInMemorySubscriptionStorageCacheInit) { return Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER) .getCache(SharedMemoryCacheConstants.SUBSCRIPTION_ID_TOPIC_NAME_CACHE); } else { CacheManager cacheManager = Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER); tenantIDInMemorySubscriptionStorageCacheInit = true; return cacheManager.<String, String>createCacheBuilder(SharedMemoryCacheConstants.SUBSCRIPTION_ID_TOPIC_NAME_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setStoreByValue(false).build(); } }
public Cache<String, Subscription> getSubscriptionsCache() { if (topicCacheInit) { return Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER).getCache(topicCacheName); } else { CacheManager cacheManager = Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER); String cacheName = topicCacheName; Cache<String, Subscription> newCache = cacheManager.<String, Subscription>createCacheBuilder(cacheName). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setStoreByValue(false).build(); topicCacheInit = true; return newCache; } } }
/** * Cache to keep the subscription details with the topics. This is important in finding subscriptions * for a particular topic when publishing a message to a topic. */ public static Cache<String, SubscriptionContainer> getTopicSubscriptionCache() { if (topicSubscriptionCacheInit) { return Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER) .getCache(SharedMemoryCacheConstants.TOPIC_SUBSCRIPTION_CACHE); } else { CacheManager cacheManager = Caching.getCacheManagerFactory() .getCacheManager(SharedMemoryCacheConstants.INMEMORY_EVENT_CACHE_MANAGER); topicSubscriptionCacheInit = true; return cacheManager.<String, SubscriptionContainer>createCacheBuilder(SharedMemoryCacheConstants.TOPIC_SUBSCRIPTION_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS, SharedMemoryCacheConstants.CACHE_INVALIDATION_TIME)). setStoreByValue(false).build(); } }
if (manager != null) { if (certificateCacheExpiry > 0) { manager.<String, CertificateResponse>createCacheBuilder(CertificateCacheManagerImpl.CERTIFICATE_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, certificateCacheExpiry)).setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration. if (certificateCacheExpiry > 0) { Caching.getCacheManager(). <String, CertificateResponse>createCacheBuilder(CertificateCacheManagerImpl.CERTIFICATE_CACHE). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, certificateCacheExpiry)).setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.
private Cache<K, V> getBaseCache() { Cache<K, V> cache; CacheManager cacheManager = Caching.getCacheManagerFactory() .getCacheManager(CACHE_MANAGER_NAME); if (getCacheTimeout() > 0 && cacheBuilder == null) { synchronized (cacheName.intern()) { if (cacheBuilder == null) { cacheManager.removeCache(cacheName); cacheBuilder = cacheManager.<K, V>createCacheBuilder(cacheName). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration .Duration(TimeUnit.SECONDS, getCacheTimeout())). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration .Duration(TimeUnit.SECONDS, getCacheTimeout())). setStoreByValue(false); cache = cacheBuilder.build(); setCapacity((CacheImpl) cache); } else { cache = cacheManager.getCache(cacheName); setCapacity((CacheImpl) cache); } } } else { cache = cacheManager.getCache(cacheName); setCapacity((CacheImpl) cache); } return cache; }
private Cache<K, V> getBaseCache() { Cache<K, V> cache; CacheManager cacheManager = Caching.getCacheManagerFactory() .getCacheManager(CACHE_MANAGER_NAME); if (getCacheTimeout() > 0 && cacheBuilder == null) { synchronized (cacheName.intern()) { if (cacheBuilder == null) { cacheManager.removeCache(cacheName); cacheBuilder = cacheManager.<K, V>createCacheBuilder(cacheName). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration .Duration(TimeUnit.SECONDS, getCacheTimeout())). setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration .Duration(TimeUnit.SECONDS, getCacheTimeout())). setStoreByValue(false); cache = cacheBuilder.build(); setCapacity((CacheImpl) cache); } else { cache = cacheManager.getCache(cacheName); setCapacity((CacheImpl) cache); } } } else { cache = cacheManager.getCache(cacheName); setCapacity((CacheImpl) cache); } return cache; }
if (cacheBuilder == null) { cacheManager.removeCache(cacheName); cacheBuilder = cacheManager.<K, V>createCacheBuilder(cacheName). setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration