org.nutz.web.cache.EasyCacheManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nutz-web Show documentation
Show all versions of nutz-web Show documentation
Nutz, which is a collections of lightweight frameworks, each of them can be used independently
package org.nutz.web.cache;
import java.util.HashMap;
import java.util.Map;
public abstract class EasyCacheManager implements CacheManager {
private Map cache = new HashMap();
private T _new(String key) {
T value = null;
value = create(key);
if (value != null) {
cache.put(key, value);
}
return value;
}
public synchronized T get(String key) {
T value = null;
if (cache.containsKey(key)) {
value = cache.get(key);
if (isExpired(value)) {
value = _new(key);
}
} else {
value = _new(key);
}
return value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy