This email made me aware of that cool new removeGroup and OSCache features.
Thanks. Two little howevers...
In my testing, it worked only with LOCAL_CACHE, as the original poster
said. Not a big deal for me; SHARED_CACHE is rarely necessary. The same
was true with OSCache.
I couldn't get OSCache to work at first. I stepped through the code and
learned that the queryCacheFactory isn't created unless the
dataContextFactory is also specified. (In
DataDomain.initWithProperties().) I don't see the logic to that... why
would those two settings be interdependent? It was easy to work around by
specifying a no-op DataContextFactory.
On Wed, May 26, 2010 at 9:13 AM, Andrus Adamchik <andru..bjectstyle.org>wrote:
> Odd. MapQueryCacheFactory supports 'removeGroup' method (although it is not
> very efficient compared to say OSQueryCacheFactory). Can you possibly run
> this in debugger to check the state of the cache?
>
> Andrus
>
>
>
>
> On May 25, 2010, at 3:47 PM, Bob Schellink wrote:
>
> Hi all,
>>
>> I'm trying to add Cayenne caching for a web project I'm working on. A new
>> DataContext is created for
>> each request so I'm looking at adding a shared cache for entities that
>> doesn't change often. However
>> if one of those entities does get updated, I want to refresh the cache.
>>
>> To start off with I'm trying to test with a small standalone application,
>> following the
>> documentation here:
>>
>> http://cayenne.apache.org/doc/query-result-caching.html
>>
>> My test is fairly similar expect that I specify SHARED_CACHE instead of
>> LOCAL_CACHE:
>>
>> SelectQuery query = new SelectQuery(Artist.class);
>> query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
>> query.setCacheGroups("artists");
>>
>> I'm also using the default LRUMap.
>>
>> From my test I can see that the query data is cached, but when I update
>> the entity, invoke
>> removeGroup and execute my query a second time, the database is not hit,
>> so I assume the cached data
>> is returned.
>>
>> Before going further I just wanted to check whether removeGroup does in
>> fact work on shared caches?
>> Chances are that I've misconfigured the caching.
>>
>> Kind regards
>>
>> Bob
>>
>>
>
This archive was generated by hypermail 2.0.0 : Thu May 27 2010 - 14:49:07 UTC