Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Support database cache store tenancy #1290

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lukinovec
Copy link
Contributor

@lukinovec lukinovec commented Jan 13, 2025

This PR adds the DatabaseCacheBootstrapper. The bootstrapper can be used instead of CacheTenancyBootstrapper for the tenant cache to be saved in the tenant databases instead of keeping it in the central DB.

On bootstrap(), DatabaseCacheBootstrapper sets the database cache store's connection to 'tenant' and deletes the database cache store from the CacheManager's resolved stores -- this forces the manager to resolve a new instance of the database store created with the 'tenant' DB connection on the next cache operation.

On revert(), the bootstrapper reverts the database cache store's connection back to the originally used connection (again, by altering the database cache store's configured connection and deleting the databaes store from the manager's resolved stores).

Solves #852

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.73%. Comparing base (0e223e0) to head (f7aaae0).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1290      +/-   ##
============================================
+ Coverage     84.68%   84.73%   +0.04%     
- Complexity     1036     1039       +3     
============================================
  Files           175      176       +1     
  Lines          3043     3052       +9     
============================================
+ Hits           2577     2586       +9     
  Misses          466      466              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stancl stancl changed the title Support database cache store tenancy [4.x] Support database cache store tenancy Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant