Hi Andrus, I have some getters in DataObjects that use some DB properties for calculation, e.g. I read other data from DB and to kind of lookups, so I got a much better performance when I introtuced a caching of this calculated values. I just use a concurrent hash map to realize the caching. Now I need a trigger for invalidation of the cached values, when the DataObject itself get's invalidated?
regards Meex Andrus Adamchik <[email protected]> schrieb am Mi., 8. März 2017 um 20:24 Uhr: > Hi Markus, > > Snapshot version reflects the version of a cached snapshot that was used > to sync the current state of the object (this is probably obvious). The > behavior observed by you may actually be a bug (and we may need to > investigate it). > > Generally I would recommend against relying too much on snapshot version > API. I always considered it an implementation detail (though of course it > is publicly accessible... oh well) that may easily fall victim of a future > DataObject redesign (e.g. see the parallel 'Fetching lots of objects' > thread). > > Can you explain how your cache is intended to work? Perhaps there is a > callback/listener solution to it? > > Andrus > > > On Mar 6, 2017, at 5:04 PM, Markus Reich <[email protected]> > wrote: > > > > Hi, > > > > I always thought that when the content of an object changes (by commit) > the > > version gets incremented. I analyzed this a bit further and found sthg. > > which is very clear for me :-/ > > > > When I have two DataObjects with the same key/id and I change a value in > > one Object, I got a higher version after committing the changes. The > other > > DataObjects also "gets" the new value, but the snapshot version stays the > > same? > > > > The background is that I try to build a cache on computed values of > > DataObjects, so I need an indicator for invalidating my cache, I thought > > snapshot version would be perfect :-) but so it seems that this won't > work > > for my idea :-/ > > > > best regards > > Meex > >
