Model Cache Behavior

Are query parameters cached separately? for example are these all cached the same or differently?
search.location
search.location?key=something&value=somethingelse
search.location?key=somethingNew&value=somethingelseNew

My hope and understanding is that these form the RID and should all have their own cache, is that right?

Yes, you are correct. Those are different RID’s, with different queries. Resgate will cache them separately.

However, the service can choose to tell Resgate to if two different query strings are identical in function, and should not be cached as separate resources. This is done in the response to the get request; more specifically the value of the query property in the result.

If two get requests for two seemingly different RIDs (different query strings) has the same query property in the result, then Resgate will treat those RIDs as identical, and share cache value.

Let’s take these RIDs:

  • search.location?key=something&value=somethingelse
  • search.location?value=somethingelse&key=something

It is the same query, just switched place of value and something. However, Resgate doesn’t know if this difference matter. But if the service responds to both get requests by setting the normalized query value to the same (eg. key=something&value=somethingelse), then Resgate will know they are the same, and will only have a single cached version.

You can read about it here:

https://resgate.io/docs/advanced-topics/query-resources/#normalized-query

Best regards,
Samuel

perfect that helps, ty