/** * 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); }
@Override public void deregisterAllListener(String name) { final EventService eventService = getNodeEngine().getEventService(); final Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, name); if (registrations != null) { for (EventRegistration registration : registrations) { Closeable listener = closeableListeners.remove(registration.getId()); if (listener != null) { IOUtil.closeResource(listener); } } } eventService.deregisterAllListeners(AbstractCacheService.SERVICE_NAME, name); CacheContext cacheContext = cacheContexts.get(name); if (cacheContext != null) { cacheContext.resetCacheEntryListenerCount(); cacheContext.resetInvalidationListenerCount(); } }