Обнаружена неиспользуемая переменная expires в файле lib/secure_session.rb, похоже, это ошибка
def self.expiry
@expiry ||= 1.hour.to_i
end
def self.expiry=(val)
@expiry = val
end
def set(key, val, expires: nil)
expires ||= SecureSession.expiry
$redis.setex(prefixed_key(key), SecureSession.expiry.to_i, val.to_s)
true
end
def [](key)
$redis.get(prefixed_key(key))
end
def []=(key, val)
if val == nil
def set(key, val, expires: nil)
expires ||= SecureSession.expiry
$redis.setex(prefixed_key(key), SecureSession.expiry.to_i, val.to_s)
true
end
gerhard
(Gerhard Schlager)
10.Ноябрь.2019 13:19:11
2
@sam , не должно ли это быть $redis.setex(prefixed_key(key), expires.to_i, val.to_s)? Похоже, что тесты не падают, потому что они используют значение по умолчанию — 1 час.
sam
(Sam Saffron)
11.Ноябрь.2019 00:22:49
3
Хорошо подмечено, да, @gerhard , звучит правильно, исправлено. Отличное замечание, @coocooooo .
committed 12:18AM - 11 Nov 19 UTC
Previously we were always hard-coding expiry, this allows the secure session
to … correctly handle custom expiry times
Also adds a ttl method for looking up time to live