module Card::Cache::SharedClass

class methods for Card::Cache::Shared

Public Instance Methods

new_stamp() click to toggle source

stamp generator

# File lib/card/cache/shared_class.rb, line 10
def new_stamp
  Time.now.to_i.to_s(36) + rand(999).to_s(36)
end
renew() click to toggle source
# File lib/card/cache/shared_class.rb, line 18
def renew
  @stamp = nil
end
reset() click to toggle source
# File lib/card/cache/shared_class.rb, line 22
def reset
  @stamp = new_stamp
  Cardio.cache.write stamp_key, @stamp
end
stamp() click to toggle source
# File lib/card/cache/shared_class.rb, line 5
def stamp
  @stamp ||= Cardio.cache.fetch(stamp_key) { new_stamp }
end
stamp_key() click to toggle source
# File lib/card/cache/shared_class.rb, line 14
def stamp_key
  "#{Cardio.database}-stamp"
end