Re: Question about Caching.

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Apr 21 2009 - 06:21:07 EDT

  • Next message: Nikos Paraschou: "Re: Question about Caching."

    > Shouldn't it first look in cache?

    Yes it should. Are you using the same set of parameters in both cases?
    And also which version of Cayenne is this?

    Andrus

    On Apr 21, 2009, at 12:28 PM, Nikos Paraschou wrote:

    > Hello,
    >
    > I created an Object Select Query in the Modeller which selects * from
    > table Vehicles. The query has a qualifier (plate = $plate). In Result
    > Caching I selected Shared Cache and unchecked the checkbox Refresh
    > Results.
    >
    > I wrote the following code:
    >
    > Map params = new HashMap();
    > params.put("plate", "koz-6657");
    >
    > List allVehicles = context.performQuery("selectVehicles",
    > false);
    > List specificVehicle = context.performQuery("selectVehicles",
    > params, false);
    >
    > I noticed that the first call of performQuery stores the retrieved
    > Vehicle Objects in cache.
    > But the second call, instead of getting the specific vehicle from
    > cache
    > it sends a query to the database.
    >
    > Why is this happening? Shouldn't it first look in cache?
    >
    > Thank you,
    > Nikos Paraschou
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Apr 21 2009 - 06:21:46 EDT