1 26 27 package org.nextime.ion.frontoffice.smartCache; 28 29 import java.util.Vector ; 30 31 import javax.servlet.ServletConfig ; 32 import javax.servlet.ServletContext ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.http.HttpServlet ; 35 import javax.servlet.jsp.JspFactory ; 36 import javax.servlet.jsp.JspWriter ; 37 import javax.servlet.jsp.PageContext ; 38 39 import org.apache.taglibs.cache.CacheUtil; 40 import org.nextime.ion.framework.business.Publication; 41 import org.nextime.ion.framework.business.Section; 42 import org.nextime.ion.framework.business.impl.PublicationImpl; 43 import org.nextime.ion.framework.business.impl.SectionImpl; 44 import org.nextime.ion.framework.event.WcmEvent; 45 import org.nextime.ion.framework.event.WcmListener; 46 import org.nextime.ion.framework.mapping.Mapping; 47 48 public class SmartCacheManager extends HttpServlet implements WcmListener { 49 50 static { 51 PublicationImpl.addListener(new SmartCacheManager()); 52 SectionImpl.addListener(new SmartCacheManager()); 53 } 54 55 private static ServletContext context; 56 57 60 public void objectCreated(WcmEvent event) { 61 cleanCache(); 62 } 63 64 67 public void objectDeleted(WcmEvent event) { 68 cleanCache(); 69 } 70 71 74 public void objectModified(WcmEvent event) { 75 cleanCache(); 76 } 77 78 protected void cleanCache() { 79 context.setAttribute("ion_lastUpdate", System.currentTimeMillis()+""); 89 } 90 91 94 public void init(ServletConfig arg0) throws ServletException { 95 context = arg0.getServletContext(); 96 } 97 98 } 99 | Popular Tags |