我想用Java中的ehcache做一些我认为应该非常简单的事情,但是我花了足够的时间来挫败自己的文档......
将值写入磁盘永久缓存.关掉.
再次启动并读取该值.
这是我的Java函数:
private static void testCacheWrite() {
  // create the cache manager from our configuration
  URL url = TestBed.class.getClass().getResource("/resource/ehcache.xml");
  CacheManager manager = CacheManager.create(url);
  // check to see if our cache exits, if it doesn't create it
  Cache testCache = null;
  if (!manager.cacheExists("test")) {
    System.out.println("No cache found. Creating cache...");
    int maxElements = 50000;
    testCache = new Cache("test", maxElements,
      MemoryStoreEvictionPolicy.LFU, true, null, true, 60, 30,
      true, Cache.DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS, null);
    manager.addCache(testCache);
    // add an element to persist
    Element el = new Element("key", …在谷歌代码上提供的ehcache-spring-annotations库中,可以使用配置选项"create-missing-caches"来动态创建动态缓存(未在ehcache.xml中定义缓存).纯弹簧ehcache抽象(Spring 3.1.1)中是否有类似的配置?或者有没有其他方法可以使用spring ehcache抽象创建动态缓存?