Rack::Attack.cache.prefix = "custom-prefix"
Rack::Attack.cache is an instance of the Rack::Attack::Cache class.
質問
We're running several apps against the same Memcached, so I'd like to configure different prefixes for all apps using Rack::Attack. By default, several apps would overwrite each others' cache.
I've seen the prefix accessor in Rack::Attack::Cache
and there's even a low-level spec for it but there are no examples on how to use it.
According to the README and the introductory blogpost, I never have to deal with Rack::Attack::Cache
but always with the higher-level Rack::Attack
.
So, how can two or more apps use the same memcached for Rack::Attack without overwriting each others' cache keys?
解決
Rack::Attack.cache.prefix = "custom-prefix"
Rack::Attack.cache is an instance of the Rack::Attack::Cache class.