-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hi
Have some issues testing this in development.
Maybe i'm doing something wrong.
if i set
config.action_dispatch.rack_cache = {
meta_store: ::Rack::Cache::MetaStore::Redis.new("#{Rails.credentials.redis_url}/1/rack_cache_metastore", default_ttl: 120),
entity_store: ::Rack::Cache::EntityStore::Redis.new("#{Rails.credentials.redis_url}/1/rack_cache_entitystore", default_ttl: 120)
# NOTE: `:metastore` and `:entitystore` are also supported.
}
i get a heap store with custom options it ignores
=> #<Rack::Cache::MetaStore::Heap:0x0000000117e550e8
@hash={},
@options=
{:verbose=>true,
:meta_store=>
#<Rack::Cache::MetaStore::Redis:0x000000011a839558
@cache=#<Redis client v5.4.1 for redis://localhost:6379/7>,
@default_ttl=120,
@options={:default_ttl=>120}>,
:entity_store=>
#<Rack::Cache::EntityStore::Redis:0x000000011a837d98
@cache=#<Redis client v5.4.1 for redis://localhost:6379/7>,
@default_ttl=120,
@options={:default_ttl=>120}>,
:compress=>true}>
Rack-cache needs metastore and entitystore settings to be present to initialize a store (using scheme).
So without them, heap store is used
If you set metastore and entitystore to a redis url, you get a store, but without custom options playing any role - default_ttl set for rack-cache is working.
#<Rack::Cache::EntityStore::Redis:0x00000001183a4260
@cache=#<Redis client v5.4.1 for redis://localhost:6379/7>,
@default_ttl=31536000,
@options=
{:verbose=>true,
:metastore=>"redis://localhost:6379/7",
:entitystore=>"redis://localhost:6379/7",
:meta_store=>
#<Rack::Cache::MetaStore::Redis:0x000000011ad895d0
@cache=#<Redis client v5.4.1 for redis://localhost:6379/7>,
@default_ttl=120,
@options={:default_ttl=>120}>,
:entity_store=>
#<Rack::Cache::EntityStore::Redis:0x000000011ad87e10
@cache=#<Redis client v5.4.1 for redis://localhost:6379/7>,
@default_ttl=120,
@options={:default_ttl=>120}>,
:compress=>true}>
Seems docs are bad. As if these default_ttl custom settings never worked as nothing is checking them.
Nothing in the gem's code addresses meta_store or entity_store - how these could work at all.
Metadata
Metadata
Assignees
Labels
No labels