Play with solid_cache (#34)

Reviewed-on: #34
This commit is contained in:
Andrew Tomaka 2024-09-08 21:51:16 -04:00
parent bfc017153f
commit 0a25c2ae9a
7 changed files with 53 additions and 6 deletions

View file

@ -10,8 +10,14 @@ default: &default
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
primary:
<<: *default
database: db/development.sqlite3
cache:
<<: *default
database: db/development_cache.sqlite3
migrations_paths: db/cache_migrate
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
@ -21,5 +27,10 @@ test:
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
primary:
<<: *default
database: storage/production.sqlite3
cache:
<<: *default
database: storage/production_cache.sqlite3
migrations_paths: db/cache_migrate

View file

@ -28,7 +28,7 @@ Rails.application.configure do
end
# Change this to :null_store to avoid any caching
config.cache_store = :memory_store
config.cache_store = :solid_cache_store
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local

View file

@ -66,7 +66,7 @@ Rails.application.configure do
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
config.cache_store = :solid_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
config.active_job.queue_adapter = :solid_queue

16
config/solid_cache.yml Normal file
View file

@ -0,0 +1,16 @@
default: &default
database: cache
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 %>
development:
<<: *default
test:
<<: *default
production:
<<: *default