rails icon indicating copy to clipboard operation
rails copied to clipboard

Pool disabled query cache handling

Open djmb opened this issue 1 year ago • 0 comments

Motivation / Background

For Solid Cache, we want to be able to read and write from the cache database without using the query cache.

We also don't want to expire the query cache on other connection pools when we write. Writing to the Rails cache shouldn't invalidate the main query cache.

This is an alternative to https://github.com/rails/rails/pull/50695, based on @byroot's suggestion here.

Detail

After a database write we clear the query cache on all connection pools. The change here is that we will now only do that if either the connection pool or the connection itself has the query cache enabled.

The query cache is enabled on all connection pools by the executor hooks, so to take advantage of this we'll need to add another executor hook that disables the query cache on the Solid Cache connection pool (but only when it has a dedicated pool).

Checklist

Before submitting the PR make sure the following are checked:

  • [x] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • [x] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • [x] Tests are added or updated if you fix a bug or add a feature.
  • [x] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

djmb avatar Jan 12 '24 09:01 djmb