Removing Cayenne cache groups

From: Bob Schellink (sabob..mail.com)
Date: Tue May 25 2010 - 12:47:00 UTC

  • Next message: Steve Wells: "Re: OutOfMemory with large number of inserts"

    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 : Tue May 25 2010 - 12:47:38 UTC