ehcache

Infinispan equivalent to ehcache's copyOnRead and copyOnWrite

Hi, I am planning to implement a cache solution into an existing web app. Nothing complicated: basically a concurrent map that supports overflowing to disk and automatic eviction. Clustering the cache could be requirement in the future, but not now. I like ehcache's copyOnRead and copyOnWrite features, because it means that I don't hav...

Spring, Hibernate and Ehcache - Wrong entities

Hi there, I've got a webapp which uses spring+hibernate for my data layer. I'm using 2nd level caching with ehcache as provider. Everything seems to work so far but sometimes we encounter a problem which I can't really figure out atm. One of my tables is used for labels within the application - every user who logs access this table wit...

hibernate second level ehcache miss problem

Hi all I'm trying to get a second-level hibernate cache working, using the ehcache implementation. I'm sure it's some obvious noob mistake I'm making, but I can't see what it is! To test out my cache, I'm doing the following: Creating an object and saving it. I 'get' it once within the transaction, where I can see I get the object ba...

EhCache default cache in java

Hello I have this configuration for ehCache: <ehcache> <defaultCache name="defaut" maxElementsInMemory="5" eternal="false" timeToIdleSeconds="20" timeToLiveSeconds="20" overflowToDisk="false" diskPersistent="false" memoryStoreEvictionPol...

Ehcache diskstore is deleted during application restart

I have an ehcache setup, that works just fine, except that the persistent diskstore data is removed everytime I restart my application/server (Spring application on TcServer/Tomcat). The whole point of using the persistent diskstore was to be able to persist the cache in spite of application restarts. Here is my ehcache.xml <?xml vers...

Using EhCache for session.createCriteria(...).list()

I'm benchmarking the performance gains from using a 2nd level cache in Hibernate (enabling EhCache), but it doesn't seem to improve performance. In fact, the time to perform the query slightly increases. The query is: session.createCriteria(MyEntity.class).list(); The entity is: @Entity @Cache(usage = CacheConcurrencyStrategy.NONSTR...

unable to inject seam cache provider

Env: Seam 2.2, ehcache-core 2.1.0 I tried injecting the CacheProvider using the following call in my bean scoped for session @In CacheProvider cacheProvider; WEB-INF\components.xml contains the following line to enable the cache provider <cache:eh-cache-provider/> The above configuration seems to return a null value for t...

What cache concurrency strategy should be used for @ManyToOne fields

What cache concurrency strategy should be used for @ManyToOne fields for a particular entity class. Would it make sense to use READ_ONLY instead of READ_WRITE, since these fields usually don't change after entity creation @ManyToOne(fetch = FetchType.LAZY) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) ... private User user; ...

Hibernate 2nd level cache ObjectNotFoundException with a high number of concurrent transactions

We have a Java application that uses MySQL, Hibernate (3.5.1-Final) and EHcache(1.2.3) for our 2nd level cache. Our hibernate.properties isolation level is Read-committed isolation = 2 # 2-Read committed isolation hibernate.connection.isolation=2 Under a high number of concurrent transactions, we're seeing an issue where certain col...

How to make use of element versioning in an EHCache instance?

I am caching objects that are being sent to my component in an asynchronous way. In other words, the order in which these objects arrive is unpredictable. To avoid any issues, I have included a version attribute to my objects (which basically is a timestamp). The idea is that any object that arrives with a version that's older than the o...

direct access to ehcache and only use hibernate on a cache miss

Env: Seam 2.2.0, JPA, Hibernate 3.3.x, ehcache-core 2.0.1 Here are some observations on using a cache along with Hibernate. We are already using the 2nd level cache but not quite comfortable with the response times. The third option mentioned in the above reference (Direct access to EHCache, only use Hibernate on a cache miss: 20 secon...

Can you use ehcache 2.1.0 with Hibernate 3.3.x

ehcache-core-2.1.0.jar seems to have the following dependency, does it imply I cannot use this with hibernnate-core-3.3.x.jars <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.5.1-Final</version> <scope>provided</scope> </dependency> ...

why are ehcache disk store invalidated after jvm restarts?

I have a java app running on JDK 1.6.0_17 on Linux. I'm using ehcache 2.1.0, with a very simple ehcache.xml file: <diskStore path="/ext/ehcache"/> <defaultCache overflowToDisk="true" diskPersistent="true" maxElementsInMemory="10000" maxElementsOnDisk="1000000000" eternal="true"> </defaultCache> In my java app...

query results are not found in cache

Env: JBoss 5.1, ehcache 2.1.0, hibernate 3.3.x, seam 2.2.0 ehcache.xml (2.1.0 version) contains the following lines, but my query results are not found in cache. Am I supposed to set a cache region for each of the queries which are fired. What am I missing here? <!-- Cache configuration --> <cache name="org.hibernate.cache.UpdateTimest...

Webservices performance best practices

All, I am working on creating a toolbar that looks at certain links on a page and injects some links of my own by getting them from a webservice, which I am writing too. There can be 100s of links on a page and there can be 100,000s of such toolbars installed. The question is, what are the best practices I should follow to make sure t...

Caching Pattern: What do you call (and how do you replace) OpenSymphony OsCache "group" paradigm

Hi all, A caching issue for you cache gurus. Context We have used OpenSymphony's OsCache for several years and consider moving to a better/stronger/faster/actively-developed caching product. Problem We have used OsCache's "group entry" feature and have not found it elsewhere. In short, OsCache allows you to specify one or more gro...

JCache with Oracle Coherence

Oracle Coherence states that it is "JCache-compliant". How can I take my code written against JSR-107, specifically the ehcache-jcache jar, and run it against Oracle Coherence? ...

How to cache rarely changed many-to-one entity in CF ORM?

How to cache rarely changed many-to-one entity in CF ORM, such as, userType where there are only < 10 types? I don't want the extra select to get the type name. EhCache? Any XML needed to be config first? Any thing I need to add in the many-to-one cfproperty? Thank you. ...

Hibernate + EhCache = java.io.NotSerializableException

I'm doing load test now. After approximate 900 requests i got this error: [ 03.08.10 11:49:00.465] [Store org.hibernate.cache.StandardQueryCache Spool Thread] ERROR net.sf.ehcache.store.DiskStore - org.hibernate.cache.StandardQueryCacheCache: Failed to write element to disk 'sql: select hotelfeatu0_.name as col_0_0_ from feature hotelf...

Dynamically change ehcache configuration

Hi, I want to dynamically change the configuration of the EhCache instance we're using, specifically the maxElementsInMemory setting. We are using EhCache 1.5 and I can see that it is possible API-wise: cache.getCacheConfiguration().setMaxElementsInMemory(num); But the documentation of EhCache says: After a Cache has been starte...