Re: Cayenne 3.0 cache RefreshQuery for NamedQuery

From: Evgeny Ryabitskiy (evgeny.ryabitski..mail.com)
Date: Tue Jul 20 2010 - 14:51:11 UTC

  • Next message: Andrus Adamchik: "Re: Cayenne 3.0 cache RefreshQuery for NamedQuery"

    Thx, for your reply.

    Now, I see only events related with Entity manipulations. Is there a
    way to add listener for NamedQuery execution?

    As I understand Event listeners could be configured in some "static"
    section while Cayenne configuration initialization...
    It's not so bad until you have ~30 cashed tables and almost 100-200
    queries to that tables.
    Problem that it's had to monitor that all Update queries got their
    listener when this information is decomposed between Java Code and XML
    with SQL Templates.

    Idea was to create such architecture where "Persistent" (DBMS related)
    layer is separate from Java logic and caching could be handled by only
    map.xml changes.

    Evgeny.

    2010/7/20 Andrus Adamchik <andru..bjectstyle.org>:
    > Sorry for not replying to this earlier. Per my comment on CAY-1465, I
    > suggest just map entity event listeners to do cache invalidation. I am
    > personally doing that everywhere.
    >
    > Andrus
    >
    > On Jul 13, 2010, at 12:56 PM, Evgeny Ryabitskiy wrote:
    >
    >> Hello 2 everyone!
    >>
    >> I was studing Group Cache stuff. And it's pretty cool!
    >> Only thing I am missing is marking some NamedQuery as Group Refresh Query.
    >>
    >> It can be useful for this case:
    >>
    >> I have 2 selects (NamedQueries) for table Artists, which have SHARED
    >> cache policy:
    >>
    >> MyArtistsSelectQuery1 from group ArtistsTableGroup:
    >> select * from Artists where isModern = 0
    >>
    >> MyArtistsSelectQuery2 from group ArtistsTableGroup:
    >> select * from Artists where isModern = 1
    >>
    >> And one insert:
    >> MyArtistsInsertQuery1
    >> insert into Artists values (....) .....
    >>
    >>
    >> Select NamedQueries are marked by properties in XML
    >>                <property name="cayenne.GenericSelectQuery.cacheStrategy"
    >> value="SHARED_CACHE"/>
    >>                <property name="cayenne.GenericSelectQuery.cacheGroups"
    >> value="ArtistsTableGroup"/>
    >> And it's cool!!!
    >>
    >> So, I would like to mark insert query as trigger for cache group
    >> removingin SHARED cache, like implicit execution of:
    >> domain.getQueryCache().removeGroup("ArtistsTableGroup");
    >> after successful insert.
    >>
    >>
    >>
    >> I haven't find this feature. Am I missed something or shall we add one
    >> more JIRA issue for 3.1?
    >>
    >>
    >> Evgeny.
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Jul 20 2010 - 14:52:40 UTC