Re: caching persistent objects

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Apr 28 2006 - 08:55:00 EDT

  • Next message: Andrus Adamchik: "Re: How to enforce Delete before Insert?"

    On Apr 26, 2006, at 7:46 PM, Cypher ! wrote:
    > how do I turn the QueryLogger on and off?

    http://objectstyle.org/confluence/display/CAYDOC/Configuring+Logging

    > The problem I am having is the application is hitting the database
    > for virtually every request and not caching any data at all. [...]
    > How do I enable shared caching and other types of caching

    You need to understand that there is no single solution to persistent
    data caching that will address all situations, short of keeping the
    entire database in memory, but if you are using Oracle, this is
    probably not what you want. Still Cayenne provides a number of
    facilities to do smart caching. You'll need to understand them and
    apply as appropriate:

    1. Query caching. I assume you've seen this page:

    http://objectstyle.org/confluence/display/CAYDOC/Caching+Query+Results

    A SHARED_CACHE policy is especially helpful when reading shared
    static data, such as a list of countries or us states, etc.

    2. Prefetching - optimizing your queries:

    http://objectstyle.org/confluence/display/CAYDOC/Prefetching

    3. DataObjectUtils - object retrieval by PK will use shared cache if
    possible.

    4. Relationship caching. This mostly applies to to-one relationships
    - cross-DataContext to-one relationships are automatically resolved
    from cache. You don't have to do anything.

    Andrus



    This archive was generated by hypermail 2.0.0 : Fri Apr 28 2006 - 08:55:26 EDT