1 24 package org.riotfamily.website.cache; 25 26 import javax.servlet.http.HttpServletRequest ; 27 28 import org.riotfamily.cachius.Cache; 29 import org.riotfamily.cachius.CacheItem; 30 import org.riotfamily.cachius.spring.CacheableControllerHandlerAdapter; 31 import org.riotfamily.riot.security.AccessController; 32 33 40 public class RiotAwareCacheableControllerHandlerAdapter 41 extends CacheableControllerHandlerAdapter { 42 43 private String riotCacheKeyPrefix = "riot:"; 44 45 public RiotAwareCacheableControllerHandlerAdapter(Cache cache) { 46 super(cache); 47 } 48 49 53 public void setRiotCacheKeyPrefix(String riotCacheKeyPrefix) { 54 this.riotCacheKeyPrefix = riotCacheKeyPrefix; 55 } 56 57 protected CacheItem getCacheItem(String cacheKey, 58 HttpServletRequest request) { 59 60 if (cacheKey != null && AccessController.isAuthenticatedUser()) { 61 cacheKey = riotCacheKeyPrefix + cacheKey; 62 } 63 return super.getCacheItem(cacheKey, request); 64 } 65 } 66 | Popular Tags |