/** * @param operation an operation name. * @return a keyExpression set. */ public List<String> getKeyExpressions(String operation) { if (m_holder == null) return null; OperationCachePolicy opPolicy = m_holder.getOperationCachePolicies().get(operation); if (opPolicy == null) return null; return opPolicy.getKeyExpressions(); }
/** * @param operation An operation name. * @return ttl value for the operation, -1 is default for invalid operations */ public long getTTL(String operation) { long ttl = -1; if (m_holder == null) return ttl; OperationCachePolicy opPolicy = m_holder.getOperationCachePolicies().get(operation); if (opPolicy == null) return ttl; ttl = opPolicy.getTTL(); return ttl; }
/** * 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); }