cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Shared Cache Strategy
Date Tue, 19 Jul 2016 09:21:23 GMT
Hi Benny,

Yeah, there's no automatic update of query caches on object changes. That's be too expensive
(consider that you not only need to refresh the objects, but also figure out whether each
object still belongs in a given list after the update, or needs to be added to a list). So
some explicit refreshing is in order. Since 3.1 we allow developers to provide annotation-driven
hints as to which query caches need to be refreshed on a given object commit. 

Here is a good Stackoverflow post on the topic:


> On Jul 18, 2016, at 6:37 PM, Benny Menzel <> wrote:
> Dear Community,
> We are using Cayenne Server v3.0.2.
> We recently programmatically switched to the SHARED_CACHE Strategy for some of our fetches
and needed to undo that change because it did not work as we expected (maybe we misunderstood
that strategy):
> 1. Loading a Model from the Database for the first time should query the database (seems
to work)
> 2. Loading the same model from the Database the second time should get the model from
cache (seems to work)
> 3. Modifying the model and committing the changes should update the model in the database
AND the cache (seems not to work correctly, although the new values are found in the database)

> 4. Displaying the Models Properties without a refreshQuery displays the properties as
they were in step 1 or 2; It does not display the correct values from the database
> Didn’t I understand the Shared Cache correctly or is it some kind of bug that a commit
does not update the Cache?
> Thank you in advance,
> Benny

View raw message