protected Cache getGatewayKeyCache() {
   String apimGWCacheExpiry =
       ServiceReferenceHolder.getInstance()
           .getAPIManagerConfiguration()
           .getFirstProperty(APIConstants.TOKEN_CACHE_EXPIRY);
   if (!gatewayKeyCacheInit) {
     gatewayKeyCacheInit = true;
     if (apimGWCacheExpiry != null) {
       return APIUtil.getCache(
           APIConstants.API_MANAGER_CACHE_MANAGER,
           APIConstants.GATEWAY_KEY_CACHE_NAME,
           Long.parseLong(apimGWCacheExpiry),
           Long.parseLong(apimGWCacheExpiry));
     } else {
       long defaultCacheTimeout =
           Long.valueOf(
                   ServerConfiguration.getInstance()
                       .getFirstProperty(APIConstants.DEFAULT_CACHE_TIMEOUT))
               * 60;
       return APIUtil.getCache(
           APIConstants.API_MANAGER_CACHE_MANAGER,
           APIConstants.GATEWAY_KEY_CACHE_NAME,
           defaultCacheTimeout,
           defaultCacheTimeout);
     }
   }
   return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER)
       .getCache(APIConstants.GATEWAY_KEY_CACHE_NAME);
 }
 private void clearConfigCache() {
   Cache workflowCache =
       Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER)
           .getCache(APIConstants.WORKFLOW_CACHE_NAME);
   String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
   String cacheName = tenantDomain + "_" + APIConstants.WORKFLOW_CACHE_NAME;
   if (workflowCache.containsKey(cacheName)) {
     workflowCache.remove(cacheName);
   }
 }
  protected Cache getResourceCache() {

    if (!resourceCacheInit) {
      resourceCacheInit = true;
      long defaultCacheTimeout =
          Long.valueOf(
                  ServerConfiguration.getInstance()
                      .getFirstProperty(APIConstants.DEFAULT_CACHE_TIMEOUT))
              * 60;
      return APIUtil.getCache(
          APIConstants.API_MANAGER_CACHE_MANAGER,
          APIConstants.RESOURCE_CACHE_NAME,
          defaultCacheTimeout,
          defaultCacheTimeout);
    }
    return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER)
        .getCache(APIConstants.RESOURCE_CACHE_NAME);
  }
Example #4
0
 protected Cache initResourceCache() {
   return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER)
       .getCache(APIConstants.RESOURCE_CACHE_NAME);
   // return PrivilegedCarbonContext.getCurrentContext(axisConfig).getCache("resourceCache");
 }
Example #5
0
 protected Cache initCache() {
   return Caching.getCacheManager("API_MANAGER_CACHE").getCache("keyCache");
   // return PrivilegedCarbonContext.getCurrentContext(axisConfig).getCache("keyCache");
 }