Work around Rails' shard swapping lock in the Solid Cache config

Because solid cache started using shard swapping when given a
`database:` key in https://github.com/rails/solid_cache/pull/219, and
Rails doesn't distinguish which database is being swapped and which
was locked.

Hopefully I can make a change upstream that will enable swap locking
only for a specific databases. Until then, let's just use a slightly
more verbose configuration to work around it.
This commit is contained in:
Mike Dalessio
2025-03-04 08:46:20 -05:00
parent d9ece38753
commit ca77968e55
+11 -6
View File
@@ -1,17 +1,22 @@
default: &default
default_options: &default_options
store_options:
# Cap age of oldest cache entry to fulfill retention policies
# max_age: <%= 60.days.to_i %>
max_size: <%= 256.megabytes %>
namespace: <%= Rails.env %>
default_connection: &default_connection
connects_to:
database:
writing: :cache
development:
database: cache
<<: *default
<<: *default_connection
<<: *default_options
test:
<<: *default
<<: *default_options
production:
database: cache
<<: *default
<<: *default_connection
<<: *default_options