Sha256: c3cb1b3f1701c1b85480e1554f7aa811d63a82ff99b389e1313ba77154fafe42

Contents?: true

Size: 532 Bytes

Versions: 5

Compression:

Stored size: 532 Bytes

Contents

class Card
  class Cache
    # class methods for Card::Cache::Persistent
    module PersistentClass
      def stamp
        @stamp ||= Cardio.cache.fetch(stamp_key) { new_stamp }
      end

      # stamp generator
      def new_stamp
        Time.now.to_i.to_s(36) + rand(999).to_s(36)
      end

      def stamp_key
        "#{Cardio.database_name}-stamp"
      end

      def renew
        @stamp = nil
      end

      def reset
        @stamp = new_stamp
        Cardio.cache.write stamp_key, @stamp
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
card-1.101.7 lib/card/cache/persistent_class.rb
card-1.102.0 lib/card/cache/persistent_class.rb
card-1.101.6 lib/card/cache/persistent_class.rb
card-1.101.5 lib/card/cache/persistent_class.rb
card-1.101.4 lib/card/cache/persistent_class.rb