Where is the first level cache stored in sleep mode? in memory or on a hard drive?

Where is the first level cache stored in Hibernate? In memory (RAM) or on your hard drive? if it is stored in memory, if there is less memory to store all the lines of the query, how does it manage the cache in this case?

+4
source share
4 answers

A sleeping session is a first level cache. This is an object on the heap, so it is located in RAM. Usually you have enough RAM (> 256 MB) to store requests =)

+3
source

his memory, otherwise he will not offer any performance advantages.

ehcache memcached hazelcast

+1
source

Typically, caches are stored in memory, but you can access caches from the network if you use cluster caches.

Here is a list of Hibernate cache providers and the difference between them: Hibernate cache providers

You can find other cache providers that can use NoSql key / value mechanisms to handle caching.

0
source

The frist level cache is definitely located in the RAM where the session is running, so it has performance and an easy-to-use advantage.

If you think that there are too many loaded objects in the session, you can cut some of the first level cache before closing the session. see Session Interface Source Code.

public interface Session extends Serializable { ... /** * Remove this instance from the session cache. Changes to the instance will * not be synchronized with the database. This operation cascades to associated * instances if the association is mapped with <tt>cascade="evict"</tt>. * * @param object a persistent instance * @throws HibernateException */ public void evict(Object object) throws HibernateException; } 
0
source

All Articles