Adding CacheEntry to be used by the APIClient cache
This commit is contained in:
parent
a90e080ee6
commit
38af24d49d
20
src/main/java/com/cloudius/urchin/api/CacheEntry.java
Normal file
20
src/main/java/com/cloudius/urchin/api/CacheEntry.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015 Cloudius Systems
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cloudius.urchin.api;
|
||||||
|
|
||||||
|
public class CacheEntry {
|
||||||
|
long time;
|
||||||
|
public String value;
|
||||||
|
|
||||||
|
CacheEntry(String value) {
|
||||||
|
time = System.currentTimeMillis();
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean valid(long duration) {
|
||||||
|
return (System.currentTimeMillis() - time) < duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user