コード例 #1
0
 /**
  * Generates and returns the cache key given a cache context The cache context has the request
  * object. The Cache providers invoke this method to get the cacheKey that can be used for
  * indexing the response object in their cache
  *
  * @param cacheContext A CacheContext.
  * @return A CacheKey for the given CacheContext.
  * @throws ServiceException Exception during CacheKey generation.
  */
 public CacheKey generateCacheKey(CacheContext cacheContext) throws ServiceException {
   String opName = cacheContext.getOpName();
   OperationCachePolicy opPolicy = m_holder.getOperationCachePolicies().get(opName);
   if (opPolicy == null) {
     throw new ServiceException(
         ErrorDataFactory.createErrorData(
             ErrorConstants.SVC_CLIENT_CACHE_NOT_SUPPORTED, ErrorConstants.ERRORDOMAIN));
   }
   cacheContext.setTTL(opPolicy.getTTL());
   CachableValueAccessor accessorCache = m_opToValueAccessorMap.get(opName);
   if (accessorCache == null) {
     throw new ServiceException(
         ErrorDataFactory.createErrorData(
             ErrorConstants.SVC_CLIENT_CACHE_NOT_SUPPORTED, ErrorConstants.ERRORDOMAIN));
   }
   return generateCacheKey(opName, cacheContext.getRequest(), accessorCache);
 }