Questions tagged [second-level-cache]

Second-level-cache, as the name implies, is a layer of cache that lives between a "primary" cache and a data service/store (relational database, in most cases) to optimize read operations on the service/store. It is different from the primary cache in its lifespan (primary cache being limited to a request lifetime) and capabilities (persist to store, clustering, etc.).

Second-level-cache, as the name implies, is a layer of cache that lives between a "primary" cache and a data service/store (relational database, in most cases) to optimize read operations on the service/store. It is different from the primary cache in its lifespan (primary cache being limited to a request lifetime) and capabilities (persist to store, clustering, etc.).

Second-level-cache is a concept most often encountered in the context of object-persistence frameworks, such as Hibernate. The idea is to allow the persistence engine to maintain a copy of entities that are available in the data service/store so that queries to retrieve them can be fulfilled using a local lookup as opposed to a full roundtrip to the service/store which invariably lives in a different server, thus requiring a network operation and incurring the associated overhead and latency/performance impact.

350 questions
6
votes
1 answer

NHibernate 4: Second Level Cache use for lazy load child collections

We use NHibernate 4 in our asp.net mvc 4 (.net 4) application. As far as I can tell the behaviour of NHibernate 4 has changed a bit when it comes to second level caching. The following behaviour seems to have changed (please correct me if I am…
Dan Stan
  • 61
  • 1
6
votes
1 answer

Hibernate 2nd level cache objects that are lazy=false, result in a default fetch=join, is it documented anywhere?

I experience the following apparently undocumented issue, and I want to understand if I did something wrong Did anyone encounter the same issue? Is it really not documented anywhere? or did I miss something? The behavior is this Assume the…
Eran Medan
  • 44,555
  • 61
  • 184
  • 276
6
votes
3 answers

How to configure second level cache in Hibernate 4.1.5 SP1?

I have read other threads on here about this subject but none of the solutions work for me. I tried putting this in my hibernate.cfg.xml: org.hibernate.cache.spi.EntityRegion I always…
MrStack
  • 455
  • 2
  • 7
  • 22
5
votes
4 answers

Externarlize ehcache.xml to use properties from external properties file

I want to place property place holders in the ehcache.xml file (like ${}) so that the values can be replaced from external properties file (.properties) at runtime. Something like: ehcache.xml (in classpath): …
Tripti
  • 75
  • 1
  • 4
5
votes
2 answers

NHibernate Azure AppFabric Cache

Has anyone tried using the NHibernate Velocity L2 cache provider against the Azure AppFabric Cache? If so, what did you discover? On a side note, we're using SQL Azure to store our data.
5
votes
2 answers

Setting hibernate second level cache

I am new in hibernate and spring and I experiment with hibernate second level cache. But it seems doesn't work. I have a following test class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {…
Daniel
  • 417
  • 1
  • 7
  • 14
5
votes
1 answer

JPA2.0 support of custom user-types and second level cache

I'm trying to decide whether to switch from having Hibernate sprinkled all over to using JPA2.0 and thus be provider portable. 1.Does JPA2.0 support custom user-types? 2.I'm on the verge of implementing Terracotta as a second-level cache to…
Ittai
  • 5,625
  • 14
  • 60
  • 97
5
votes
1 answer

Infinispan JPA 2nd level cache defaults

I'm trying to configure Infinispan as a hibernate 2nd level cache. Everything is fine, but I want to tweak the default configuration, i.e. the values that all caches shared. Caches are automatically created for entities annotated with @Cache, and I…
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
5
votes
0 answers

Using second level Cache in Springboot + JPA repository

I Use Spring Boot configuration for Second level Cache for my Master tables. I'm not getting the second level cache configured in Spring Boot. Need to get how the Caching is done and also the retrieval. This is my Application.java class…
5
votes
0 answers

2nd level cache collection state is sometimes not synchronized with database

We're using EhCache as 2nd level cache (4.3.8.Final) in Hibernate (4.3.8.Final) for Queries (only on read-mostly tables), Entities and Collections between entities. So you could say that 2nd level cache is used intensively for optimisation…
user2054927
  • 969
  • 1
  • 12
  • 30
5
votes
2 answers

NHibernate 2nd level caching with AppFabric

Has anyone used AppFabric for their second level caching? I know it's to follow the same api as for Velocity (nhibernate.caches.velocity) but wanted to know if anyone already had some production experience of using it and if they knew of any…
dove
  • 20,469
  • 14
  • 82
  • 108
5
votes
3 answers

Hibernate second level cache - print result

I defined a second level cache in my application using @Cache annotation I am using findById query, as the following: long id = 4; Company cmp = companyDAO.findById(id); Where Company is the object that I get from the DB. How can I…
Riki
  • 145
  • 1
  • 2
  • 6
5
votes
1 answer

Which second level cache to select for nHibernate?

I have a Data Service created using WCF that internally uses nHibernate. This WCF Data Service is consumed by an Asp.Net application deployed on Web Server using Tcp Channel. To improve the performance of the nHibernate Data service I want to…
Amitabh
  • 59,111
  • 42
  • 110
  • 159
5
votes
1 answer

Why isn't nhibernate retrieving from cache in this example?

I am trying to figure out how to cache a joined query using nhibernate and it doesn't seem like its working properly Here is my code: public CacheTestViewModel GetCacheTestViewModel() { var vm = new CacheTestViewModel(); var…
leora
  • 188,729
  • 360
  • 878
  • 1,366
5
votes
1 answer

Hibernate Collection cache : How to use?

I have two entities Book and Author. Book has a collection of authors. I am using second level cache to keep the Book entity with its Authors. When debugging I can see there is putForExternalRead is happening for Book instance and each author in…