Tag: ehcache

你好世界ehcache的例子?

ehcache是​​一个巨大的可configuration的野兽,例子是相当复杂的,往往涉及到多层接口。 有没有人遇到最简单的例子,它只是caching像内存中的一个单一的数字(不是分布式,没有XML,只有尽可能less的java行)。 然后这个数字被caching了60秒,然后下一个读取请求导致它得到一个新值(例如通过调用Random.nextInt()或类似的) 使用singleton和一些同步来编写我们自己的caching来更快更容易吗? 没有spring请。

多个方法参数的@Cacheable键

从spring文档 : @Cacheable(value="bookCache", key="isbn") public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) 我怎样才能指定@Cachable使用isbn和checkWarehouse作为关键?

用Hibernate + Spring进行caching – 一些问题!

我正在开发与Spring 3和Hibernate 3.6的Web应用程序。 目前我尝试了解如何使用Spring和Hibernate进行caching。 我发现一些关于Hibernate的caching和Spring的一些资料,现在我试着把我的信息整合在一起。 我仍然对这两个框架都有一些问题,如果有人能回答他们,或者告诉我这里列出的事实是否正确,我会很高兴。 大多数情况下,简短的答案(是/否)就足够了。 我认为这个列表对其他人也是有用的,他们想了解如何使用spring和hibernate进行caching。 General 1) Hibernate支持以下caching:1级caching,2级caching,查询caching 2) Spring本身支持以下caching可能性:只是方法caching 1st Level Cache 3)第一级caching是每个Hibernate应用程序的一部分。 4)第一级caching是为每个hibernate会话创build的。 5)什么是保存在一级caching? 对象还是其属性的值? 查询和他们的结果? 2nd Level Cache 6)我发现:二级caching每个应用程序使用一次。 这不是假的吗? 是不是每个sessionfactory使用一次? 和:多个sessionfactorys =多个二级caching可能? 7)在二级caching中保存的内容:在我看来,只是属于一个logging的值,而不是对象本身。 8)当从二级caching中的一条logging存储值时,它可能存储相关的值(从通过外键连接的对象)呢? 9)在更新二级caching中的一个对象的值时,是否有可能更新caching中与它连接的对象的值呢? 10)当一个对象的值正在改变时,如何更新二级caching? 冲洗? 我可以只更新caching的一部分,或者必须更新整个caching吗? 11)第二级caching在哪里是有意义的,在哪里呢? 12)caching模式:每种caching模式是否提供了不同的caching策略? 例如使用caching模式“只读”,数据库和caching的同步是不必要的? 做其他caching模式提供同步? 我认为同步必须由开发人员自己完成? Query Cache 13)查询caching与二级caching有什么区别? 在我看来:在查询caching结果集保存,但不是与他们的价值,只是与他们的ID。 当再次使用查询并且结果集仍然是“正确的”时,属于id的值从二级caching中查询 14)对于查询caching,必须使用二级caching? 15)查询caching在哪里是合理的,哪里没有? Spring 16) Spring是否比方法caching提供更多的caching可能性? 17)方法caching没有链接到hibernatecaching 18)但是:对于方法caching第二级是必要的,如ehcache(它也可以用于hibernate) 19)可以使用方法caching没有数据库查询? Getting mixed […]

榛子vs ehcache

问题很明显,正如你在标题中看到的那样,我将不胜感激听到你对adv./disadv的想法。 他们之间的差异。 更新:我已经决定使用Hazelcast,因为分布式caching/locking机制的优点,以及非常容易的configuration,同时适应您的应用程序。

另一个未命名的CacheManager已经存在于同一个VM(ehCache 2.5)

这是当我运行我的junittesting时发生的事情… Another CacheManager with same name 'cacheManager' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following: 1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary 2. Shutdown the earlier cacheManager before […]

“堆上”和“堆外”的区别

Ehcache 谈论堆内和堆外存储器。 有什么不同? 用什么JVM参数来configuration它们?

如何区分ehcache中的生存时间和闲置时间

Ehache上的文档说: timeToIdleSeconds: Sets the time to idle for an element before it expires. ie The maximum amount of time between accesses before an element expires timeToLiveSeconds: Sets the time to live for an element before it expires. ie The maximum time between creation time and when an element expires. 我明白timeToIdleSeconds 但这是否意味着在创build并首次访问caching项后, timeToLiveSeconds不再适用了?

在Tomcat中重新部署应用程序时发生内存泄漏

当我在tomcat中重新部署应用程序时,出现以下问题: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@10d16b]) and a value of type [com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty] (value [com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty@1a183d2]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak. 另外,我在我的应用程序中使用ehcache。 这也似乎导致以下例外。 SEVERE: The web application [] created a ThreadLocal with key […]