JCache/EHCache scope

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JCache/EHCache scope

Lon Varscsak
When using JCache (in my case it’s implementation is EHCache) is an
ObjectContext’s localCache tied to the object context or is it global?  In
other words, if I use localCache will the cache go away when the object
context goes away or does it persist?

-Lon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JCache/EHCache scope

Andrus Adamchik
JCache/EhCache implementation maintains a single "physical" cache object per Cayenne cache group. It is shared between Cayenne shared cache and each one of the per-context local caches. To distinguish the entries from say 2 ObjectContexts within the cache we use unique key prefixes. When an ObjectContext goes away, its cache entries stay in the cache, but become effectively inaccessible. They will eventually get removed or replaced with other entries by the cache, depending on the cache settings.

Andrus


> On Mar 16, 2017, at 9:24 PM, Lon Varscsak <[hidden email]> wrote:
>
> When using JCache (in my case it’s implementation is EHCache) is an
> ObjectContext’s localCache tied to the object context or is it global?  In
> other words, if I use localCache will the cache go away when the object
> context goes away or does it persist?
>
> -Lon

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JCache/EHCache scope

Lon Varscsak
Ah, gotcha.  Thanks!

-Lon

On Mon, Mar 20, 2017 at 4:47 AM, Andrus Adamchik <[hidden email]>
wrote:

> JCache/EhCache implementation maintains a single "physical" cache object
> per Cayenne cache group. It is shared between Cayenne shared cache and each
> one of the per-context local caches. To distinguish the entries from say 2
> ObjectContexts within the cache we use unique key prefixes. When an
> ObjectContext goes away, its cache entries stay in the cache, but become
> effectively inaccessible. They will eventually get removed or replaced with
> other entries by the cache, depending on the cache settings.
>
> Andrus
>
>
> > On Mar 16, 2017, at 9:24 PM, Lon Varscsak <[hidden email]>
> wrote:
> >
> > When using JCache (in my case it’s implementation is EHCache) is an
> > ObjectContext’s localCache tied to the object context or is it global?
> In
> > other words, if I use localCache will the cache go away when the object
> > context goes away or does it persist?
> >
> > -Lon
>
>
Loading...