1 18 19 package org.apache.roller.util.cache; 20 21 import java.io.Serializable ; 22 23 24 45 public class LazyExpiringCacheEntry implements Serializable { 46 47 private Object value = null; 48 private long timeCached = -1; 49 50 51 public LazyExpiringCacheEntry(Object item) { 52 this.value = item; 53 this.timeCached = System.currentTimeMillis(); 54 } 55 56 57 62 public Object getValue(long lastInvalidated) { 63 if(this.isInvalid(lastInvalidated)) { 64 return null; 65 } else { 66 return this.value; 67 } 68 } 69 70 71 74 public boolean isInvalid(long lastInvalidated) { 75 76 return (this.timeCached < lastInvalidated); 77 } 78 79 80 public long getTimeCached() { 81 return timeCached; 82 } 83 84 } 85 | Popular Tags |