Cache.java
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.aemds.guide.cache;
import com.adobe.aemds.guide.cache.CacheObject;
import com.adobe.aemds.guide.cache.api.CacheStore;
import java.util.Calendar;
public class Cache {
private CacheStore cacheStore;
public Cache(CacheStore cacheStore) {
this.cacheStore = cacheStore;
}
public Object put(Object key, Object value, Calendar modifiedTime) {
CacheObject cacheObject = new CacheObject(value, modifiedTime);
return this.cacheStore.put(key, cacheObject);
}
public Object get(Object key) {
CacheObject cacheObject = this.cacheStore.get(key);
if (cacheObject == null) {
return null;
}
return cacheObject.getCacheObject();
}
public void clearAll() {
this.cacheStore.clearAll();
}
public void clear(String key) {
this.cacheStore.clear(key);
}
public boolean isCacheEntryStale(Object key, Calendar updateTime) {
if (!this.cacheStore.entryExists(key)) {
return true;
}
if (updateTime == null) {
return false;
}
CacheObject cacheObject = this.cacheStore.get(key);
return cacheObject.getLastModifiedTime().compareTo(updateTime) < 0;
}
public boolean entryExists(Object key) {
return this.cacheStore.entryExists(key);
}
}