% redis-cli
127.0.0.1:6379> keys '*'
1) 'development:last_run_time'
% redis-cli
127.0.0.1:6379> keys '*'
1) 'last_run_time'
require 'test_application' | |
# Turn off the default namespacing | |
TestApplication.cache(namespace: nil).connect |
require 'stockpile-redis' | |
module TestApplication | |
Stockpile.inject_redis!(self) | |
module LastRunTime | |
def last_run_time(name, time = nil) | |
if time | |
connection.hset(__method__, name, time.8601) | |
else | |
time = connection.hget(__method__, name) | |
time = Time.parse(time) if time | |
end | |
time | |
end | |
end | |
cache_adapter(LastRunTime, self) | |
end |
In Stockpile 1.0, line 18 initializes
TestApplication.cache
. This wouldn’t be a problem, except that we have an explicit setting ofnamespace
, and this won’t be used—because the cache is being initialized before we set the namespace.This has been fixed in Stockpile 1.1