2024-02-25 12:15:55 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-08-24 13:22:01 -04:00
|
|
|
def get_cache_store
|
|
|
|
if Rails.env.test?
|
|
|
|
[:memory_store, { size: 32.megabytes }]
|
2021-11-14 16:16:36 -05:00
|
|
|
elsif Danbooru.config.disable_cache_store?
|
2021-08-24 13:22:01 -04:00
|
|
|
:null_store
|
|
|
|
else
|
2024-01-25 16:05:29 -05:00
|
|
|
[:mem_cache_store, Danbooru.config.memcached_servers, { pool: false, namespace: Danbooru.config.safe_app_name }]
|
2021-08-24 13:22:01 -04:00
|
|
|
end
|
|
|
|
end
|
2020-10-01 11:12:04 -04:00
|
|
|
|
|
|
|
Rails.application.configure do
|
|
|
|
begin
|
2021-08-24 13:22:01 -04:00
|
|
|
config.cache_store = get_cache_store
|
|
|
|
config.action_controller.cache_store = get_cache_store
|
|
|
|
Rails.cache = ActiveSupport::Cache.lookup_store(Rails.application.config.cache_store)
|
2020-10-01 11:12:04 -04:00
|
|
|
end
|
|
|
|
end
|