cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Disabling caching for all entities in a certain DataMap
Date Fri, 09 Dec 2016 07:04:36 GMT

> On Oct 25, 2016, at 3:30 PM, Hugi Thordarson <> wrote:
> Hi all.
> I’m working on a project where external applications modify the DB, so I have to disable
caching (or probably better, make it valid for only a very short period of time) for all entities
in a certain DataMap. What’s the easiest way for me to achieve this?
> Cheers,
> - hugi

Hi Hugi,

I recommend using EhCacheQueryCache and configuring expiration policies in ehcache.xml . This
is all about *query* cache of course. But with proper query cache, object cache is refreshed
as a side effect of query execution. You can install EhCacheQueryCache via Cayenne DI.

A second option is even better ... if you are using Bootique. The upcoming Bootique 0.21 integrates
newer EhCache 3.x and provides both API and XML-based EhCache configs. Still need to document
this, but in short, you drop bootique-cayenne-ehcache [1] in your app, and you already have
EhCache with default settings working. Here is an API-config example:

Configuration<String, List> c = new MutableConfiguration<String, List>()
  .setTypes(String.class, List.class)




View raw message