javax.cache.Caching.getCacheManager()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中javax.cache.Caching.getCacheManager()方法的一些代码示例,展示了Caching.getCacheManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Caching.getCacheManager()方法的具体详情如下:
包路径:javax.cache.Caching
类名称:Caching
方法名:getCacheManager

Caching.getCacheManager介绍

暂无

代码示例

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.keymgt

/**
 * Get CacheManager instance
 *
 * @param name The name of the Cache
 * @return CacheManager
 */
protected CacheManager getCacheManager(String name) {
  return Caching.getCacheManager(name);
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway

protected CacheManager getCacheManager() {
    return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER);
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway

protected Cache getKeyCache() {
  return Caching.getCacheManager(AppMConstants.API_MANAGER_CACHE_MANAGER).
      getCache(AppMConstants.KEY_CACHE_NAME);
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway

/**
 * get the cache manager
 * @return
 */
private static Cache getAppContextVersionConfigCache() {
  return Caching.getCacheManager(AppMConstants.APP_CONTEXT_VERSION_CACHE_MANAGER)
      .getCache(AppMConstants.APP_CONTEXT_VERSION_CONFIG_CACHE);
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.usage.publisher

private Cache getUsageCache() {
  return Caching.getCacheManager(AppMConstants.USAGE_CACHE_MANAGER)
      .getCache(AppMConstants.USAGE_CACHE);
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway

protected Cache getCacheFromCacheManager(String cacheName) {
  return Caching.getCacheManager(
      APIConstants.API_MANAGER_CACHE_MANAGER).getCache(cacheName);
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.usage.publisher

private Cache getUsageConfigCache() {
    return Caching.getCacheManager(AppMConstants.USAGE_CONFIG_CACHE_MANAGER)
        .getCache(AppMConstants.USAGE_CONFIG_CACHE);
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway

protected static Cache getGatewayTokenCache() {
  Cache cache = null;
  try {
    javax.cache.CacheManager manager =
        Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER);
    cache = manager.getCache(APIConstants.GATEWAY_TOKEN_CACHE_NAME);
  } catch (NullPointerException e) {
    log.error(
        "Did not found valid API Validation Information cache configuration. " +
        e.getMessage(), e);
  }
  return cache;
}

代码示例来源:origin: remoting/dubbox

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();
}

代码示例来源:origin: remoting/dubbox

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();
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway

public void invalidateOAuthKeys(String consumerKey, String authorizedUser) {
  Cache cache = Caching.getCacheManager(AppMConstants.API_MANAGER_CACHE_MANAGER).getCache(AppMConstants.KEY_CACHE_NAME);
  String cacheKey = consumerKey + ":" + authorizedUser;
  cache.remove(cacheKey);
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

public Cache.Entry getValueFromCache(ClaimCacheKey key) {
  return (Cache.Entry)Caching.getCacheManager(AppMConstants.APP_MANAGER_CACHE_MANAGER).getCache(CLAIM_CACHE_NAME).get(key);
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

public void clearCacheEntry(ClaimCacheKey key) {
    Caching.getCacheManager(AppMConstants.APP_MANAGER_CACHE_MANAGER).getCache(CLAIM_CACHE_NAME).removeAll();
  }
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway

protected String getCachedTenantDomain(String token) {
  return (String) Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER)
      .getCache(APIConstants.GATEWAY_TOKEN_CACHE_NAME).get(token);
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway

protected void removeCacheEntryFromGatewayCache(String key) {
  Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER).getCache(APIConstants.GATEWAY_TOKEN_CACHE_NAME)
      .remove(key);        
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway

protected void putInvalidTokenEntryIntoInvalidTokenCache(String cachedToken, String tenantDomain) {
  Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER).getCache(APIConstants
      .GATEWAY_INVALID_TOKEN_CACHE_NAME).put(cachedToken, tenantDomain);
}

代码示例来源:origin: org.wso2.carbon.devicemgt/org.wso2.carbon.policy.mgt.core

public static Cache<Integer, Policy> getPolicyCache(String name) {
  CacheManager manager = getCacheManager();
  return (manager != null) ? manager.<Integer, Policy>getCache(name) :
      Caching.getCacheManager().<Integer, Policy>getCache(name);
}

代码示例来源:origin: org.wso2.carbon.devicemgt/org.wso2.carbon.policy.mgt.core

public static Cache<Integer, List<Policy>> getPolicyListCache(String name) {
  CacheManager manager = getCacheManager();
  return (manager != null) ? manager.<Integer, List<Policy>>getCache(name) :
      Caching.getCacheManager().<Integer, List<Policy>>getCache(name);
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway

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);
    }
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway

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);
  }
}

相关文章