Skip to content

Commit

Permalink
fix redis caching per tenant (#2203)
Browse files Browse the repository at this point in the history
* fix redis caching per tenant

* fix specs

---------

Co-authored-by: Shana Moore <[email protected]>
  • Loading branch information
orangewolf and Shana Moore authored Aug 20, 2024
1 parent 5d31969 commit 35496ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def setup_tenant_cache(is_enabled)
ActionController::Base.perform_caching = is_enabled
# rubocop:disable Style/ConditionalAssignment
if is_enabled
Rails.application.config.cache_store = :redis_cache_store, { url: Redis.current.id }
Rails.application.config.cache_store = :redis_cache_store, { redis: Hyrax::RedisEventStore.instance }
else
Rails.application.config.cache_store = :file_store, DEFAULT_FILE_CACHE_STORE
end
Expand Down
2 changes: 1 addition & 1 deletion config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ en:
oai_admin_email: OAI endpoint contact email address
doi_reader: Show ability to read from Datacite to populate records. WIP do not use
doi_writer: Write DOIs for records. WIP do not use
cache_api: Turns on cache for API endpoints. Experimental
cache_api: Use Redis instead of disk for caching
email_subjet_prefix: String to put in front of system email subjects.
contact_email: The email address that system notifications will be sent from. Additional configuration is required to add an address from domains other than the site's domain
contact_email_to: The email address that messages submitted via the contact page are sent to
Expand Down
2 changes: 1 addition & 1 deletion spec/models/account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
it "uses Redis as a cache store" do
expect(Rails.application.config.action_controller.perform_caching).to be_truthy
expect(ActionController::Base.perform_caching).to be_truthy
expect(Rails.application.config.cache_store).to eq([:redis_cache_store, { url: "redis://localhost:6379/0" }])
expect(Rails.application.config.cache_store).to include(:redis_cache_store)
end

it "reverts to using file store when cache is off" do
Expand Down

0 comments on commit 35496ab

Please sign in to comment.