Commits

ltor...@81dbac14-341a-0410-aa85-cbcd92e6f43e  committed b4810f7

Issue number: CACHE-228 CRON expressionsto expire content at specific dates and/or times
Obtained from: Lars Torunski

  • Participants
  • Parent commits 0a63e41

Comments (0)

Files changed (1)

File src/java/com/opensymphony/oscache/web/filter/CacheFilter.java

     private int cacheScope = PageContext.APPLICATION_SCOPE; // filter scope - default is APPLICATION
     private int fragment = FRAGMENT_AUTODETECT; // defines if this filter handles fragments of a page - default is auto detect
     private int time = 60 * 60; // time before cache should be refreshed - default one hour (in seconds)
+    private String cron = null; // A cron expression that determines when this cached content will expire - default is null
     private int nocache = NOCACHE_OFF; // defines special no cache option for the requests - default is off
     private long lastModified = LAST_MODIFIED_INITIAL; // defines if the last-modified-header will be sent - default is intial setting
     private long expires = EXPIRES_ON; // defines if the expires-header will be sent - default is on
         String key = cacheKeyProvider.createCacheKey(httpRequest, admin, cache);
 
         try {
-            ResponseContent respContent = (ResponseContent) cache.getFromCache(key, time);
+            ResponseContent respContent = (ResponseContent) cache.getFromCache(key, time, cron);
 
             if (log.isInfoEnabled()) {
                 log.info("<cache>: Using cached entry for " + key);
             log.info("Could not get init parameter 'scope', defaulting to 'application'.");
         }
 
+        // filter parameter cron
+        cron = config.getInitParameter("cron");
+
         // filter parameter fragment
         try {
             String fragmentString = config.getInitParameter("fragment");