Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1585

SelectQuery automatic cache key needs FetchOffset

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1M2
    • 3.1M3, 3.0.3
    • Core Library
    • None

    Description

      SelectQueryMetadata.resolve:

      Must include the fetchOffset property from query.
      So we can cache correctly pagination queries.

      for example without this property:

      SelectQuery query = new SelectQuery(Example.class);
      query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
      query.setFetchOffset(0);
      query.setFetchLimit(10);
      ctx.performQuery(query);
      // Returns the first ten elements, cached under key "Example/10"

      Select query2 = new SelectQuery(Example.class);
      query2.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
      query2.setFetchOffset(10);
      query2.setFetchLimit(10);
      ctx.performQuery(query2);
      // Returns the first ten elements from cache, this is not correct it must return the next block of elements.
      // Because the cache key is again "Example/10"

      Attachments

        Activity

          People

            demitri Dzmitry Kazimirchyk
            paquilino Pedro Aquilino Sánchez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: