module Moneta::StringExpires

Public Instance Methods

check_expired(key) click to toggle source
# File lib/moneta.rb, line 51
def check_expired(key)
  if @expiration[key] && Time.now > Time.at(@expiration[key].to_i)
    @expiration.delete(key)
    delete(key)
  end
end

Private Instance Methods

update_options(key, options) click to toggle source
# File lib/moneta.rb, line 59
def update_options(key, options)
  if options[:expires_in]
    @expiration[key] = (Time.now + options[:expires_in]).to_i.to_s
  end
end