How to set L1 or L2 cache size-limitation. I concern of increasing the cache-size.
One way is defining timeout for cache but i want to know is it possible to make a constraint for cache size or not?
RGDS
Navid
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t. The only option is to
clearthe persistence context manually at regular intervals if you want to “control” (actually,clearis very aggressive, it removes all entities) its size.This depends on the underlying cache provider. In other words, this is done by configuring the L2 cache implementation. For example, EHCache has a
maxElementInMemoryparameter.As much as you put in it, until an eventual
OutOfMemoryError, hence the need toclearexplicitly:EntityManageris usedBut the usual pattern is to use a short-lived
EntityManagerand most use cases are not batch jobs so this is not a concern.See also