CacheKeyProvider.java :  » Media » m2engine » com » integrationpath » mengine » util » Java Open Source

Java Open Source » Media » m2engine 
m2engine » com » integrationpath » mengine » util » CacheKeyProvider.java
package com.integrationpath.mengine.util;

import javax.servlet.http.HttpServletRequest;

import com.opensymphony.oscache.base.Cache;
import com.opensymphony.oscache.web.ServletCacheAdministrator;
import com.opensymphony.oscache.web.filter.ICacheKeyProvider;

public class CacheKeyProvider implements ICacheKeyProvider {

    public String createCacheKey(HttpServletRequest httpRequest, ServletCacheAdministrator scAdmin, Cache cache) {

        // buffer for the cache key
        StringBuffer buffer = new StringBuffer(500);
        
        // part 1 of the key: the request uri
        buffer.append(httpRequest.getRequestURI());
        
//        // separation
//        buffer.append('_');
//
//        // part 2 of the key: the page id
//        buffer.append(httpRequest.getParameter("pageid"));
//        
//        // separation
//        buffer.append('_');
//        
//        // part 3 of the key: the pagination
//        buffer.append(httpRequest.getParameter("pagination"));
        
        return buffer.toString();
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.