KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > wsrp > producer > impl > helpers > CacheControlProxy


1 /*
2 * Copyright 2001-2004 The eXo platform SARL All rights reserved.
3 * Please look at license.txt in info directory for more license detail.
4 */

5
6 package org.exoplatform.services.wsrp.producer.impl.helpers;
7
8 import org.exoplatform.services.wsrp.type.CacheControl;
9
10 /*
11  * @author Mestrallet Benjamin
12  * benjmestrallet@users.sourceforge.net
13  * Date: 25 janv. 2004
14  * Time: 18:46:09
15  */

16
17 public class CacheControlProxy {
18
19   private CacheControl cacheControl;
20   private long creationTime;
21
22   public CacheControlProxy(CacheControl cacheControl) {
23     this.cacheControl = cacheControl;
24     creationTime = System.currentTimeMillis();
25   }
26
27   public CacheControl getCacheControl() {
28     return cacheControl;
29   }
30
31   public boolean isValid(){
32     if(System.currentTimeMillis() - creationTime < cacheControl.getExpires() * 1000)
33       return true;
34     else
35       return false;
36   }
37
38 }
Popular Tags