标签: ehcache-2

ehcache坚持磁盘问题

我想用Java中的ehcache做一些我认为应该非常简单的事情,但是我花了足够的时间来挫败自己的文档......

  1. 将值写入磁盘永久缓存.关掉.

  2. 再次启动并读取该值.

这是我的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", …
Run Code Online (Sandbox Code Playgroud)

java persistence ehcache ehcache-2

27
推荐指数
2
解决办法
4万
查看次数

如何使用spring ehcache抽象动态创建缓存

在谷歌代码上提供的ehcache-spring-annotations库中,可以使用配置选项"create-missing-caches"来动态创建动态缓存(未在ehcache.xml中定义缓存).纯弹簧ehcache抽象(Spring 3.1.1)中是否有类似的配置?或者有没有其他方法可以使用spring ehcache抽象创建动态缓存?

spring ehcache ehcache-2

3
推荐指数
1
解决办法
3855
查看次数

标签 统计

ehcache ×2

ehcache-2 ×2

java ×1

persistence ×1

spring ×1