在这里,我使用的是 Java 缓存系统 (JCS)。我可以在缓存中放入和获取数据。我需要整个数据集,例如键值对。请指导我一种找回它的方法。
package net.practice.so;
import org.apache.jcs.JCS;
import org.apache.jcs.access.exception.CacheException;
import org.apache.jcs.engine.control.CompositeCacheManager;
import java.util.Properties;
public class JcsPractice {
public static void main(String[] args) throws CacheException {
CompositeCacheManager ccm = CompositeCacheManager.getUnconfiguredInstance();
Properties props = new Properties();
props.put("jcs.default", "DC");
ccm.configure(props);
JCS cache = JCS.getInstance("numberCache");
cache.put(1, "one");
cache.put(2, "two");
cache.put(3, "three");
System.out.println(cache.get(2));
}
}