public class Cache { private Map cache = new HashMap() ; public Object get(String key) { return cache.get(key); } public void reload(){ Map tempCache = loadFromDB(); cache = tempCache; // safe ? }}
本文共 302 字,大约阅读时间需要 1 分钟。
public class Cache { private Map cache = new HashMap() ; public Object get(String key) { return cache.get(key); } public void reload(){ Map tempCache = loadFromDB(); cache = tempCache; // safe ? }}
转载于:https://my.oschina.net/xishuixixia/blog/141764