Fwd: Problems with caching

From: Marcin Skladaniec (marci..sh.com.au)
Date: Thu Feb 09 2006 - 16:46:38 EST

  • Next message: Andrus Adamchik: "Re: Problems with caching"

    Hello

    I can understand why caching is supporting only queries with name,
    but wouldn't it be good if all queries were cached? I must say I'm a
    kind of a newbie, so the solution which comes to my mind is simple:
    to store nodeIds for every fetched record within the dataStore, and
    than if the record exists use DataObjectUtils.objectForPK ? Would it
    be any better to re-fetching records from database ? Has anyone some
    better idea ?

    Until cayenne will support full caching there should be some
    information about this, or in javadocs or the exception should be
    printed on the screen.

    Cheers
    Marcin

    Begin forwarded message:

    > From: Marcin Skladaniec <marci..sh.com.au>
    > Date: 10 February 2006 8:39:15 AM
    > To: cayenne-use..bjectstyle.org
    > Subject: Re: Problems with caching
    > Reply-To: cayenne-use..bjectstyle.org
    >
    > Caching as for now works only with queries with name, and that is
    > all NamedQueries and SelectQuery initialized with
    > queryWithParameters(Map params, boolean pruneMissing) (did I miss
    > something ?). I think that exception telling that is consumed
    > somewhere and never displayed.
    >
    > Cheers
    > Marcin
    >
    > On 10/02/2006, at 2:53 AM, Ayhan Kondoz wrote:
    >
    >> Hi,
    >>
    >> i am trying to use the caching feature of cayenne but i can't get
    >> it to
    >> work
    >> properly. I have 2 different problems but first a quick
    >> explanation of
    >> my
    >> environment.
    >>
    >> I have multiple servers and each of them has it's own tomcat5
    >> installation.
    >> Within the tomcat5 I have an axis webservice that uses cayenne
    >> 1.1.3 to
    >> interface with a database and provides SOAP services.
    >>
    >> Each SOAP Service uses a similar logic.
    >> (a) Get the customer object, using a SelectQuery.
    >> (b) Perform the job using accounts and other object that are
    >> related to
    >> this customer.
    >>
    >>
    >> What I would like to have is something like this
    >> (1) Cacheing of the SelectQuery (used in step (a))to prevent
    >> unnecessary
    >> database IO for subsequent SOAP calls with the same customer.
    >> (2) Caching of objects that have a relationship to the customer.
    >> Meaning
    >> that if the first SOAP call accesses the accounts of a customer
    >> subsequent SOAP calls should NOT read them from the database
    >> again.
    >> The
    >> accounts should be cached along with the customer and calls to
    >> Customer().getAccount() should read the accounts from cache.
    >> (3) Changes made on one Server should be send to all other
    >> servers so
    >> that
    >> Objects that are cached can be refreshed.
    >>
    >>
    >> The first objective is easy and I had no problems with it.
    >>
    >> Expression exp = Expression.fromString("cid=" + cid);
    >> SelectQuery query = new SelectQuery(Customer.class, exp);
    >> query.setName("Customer"+cid);
    >> query.setCachePolicy(GenericSelectQuery.SHARED_CACHE);
    >> query.setRefreshingObjects(false);
    >> query.addPrefetch("accounts");
    >>
    >> It is the second and third objective I am having problems with. No
    >> matter what I try the snapshot events are not relayed to the other
    >> servers.
    >>
    >> My cayenne.xml looks like this:
    >>
    >> <property name="cayenne.JavaGroupsBridge.mcast.port" value="42000"/>
    >> <property name="cayenne.DataDomain.validatingObjectsOnCommit"
    >> value="true"/>
    >> <property name="cayenne.DataRowStore.remote.notify" value="true"/>
    >> <property name="cayenne.DataDomain.sharedCache" value="true"/>
    >> <property name="cayenne.JavaGroupsBridge.mcast.address"
    >> value="228.1.1.5"/>
    >> <property name="cayenne.DataRowStore.EventBridge.factory"
    >> value="org.objectstyle.cayenne.event.JavaGroupsBridgeFactory"/>
    >>
    >> JavaGroups seems to work fine, at least the McastReceiverTest and
    >> McastSenderTest from the JavaGroups documentation works.
    >> Nevertheless the snapshot events do not reach the other servers.
    >>
    >> Ideas? Comments?
    >>
    >> Thanks
    >> Ayhan Kondoz
    >



    This archive was generated by hypermail 2.0.0 : Thu Feb 09 2006 - 16:46:43 EST