Parent

Methods

Wonderfl::Utils::Cache

Caches response data from APIs

Public Class Methods

new(filename, expire) click to toggle source

(Not documented)

# File lib/wonderfl/utils.rb, line 16
    def initialize(filename, expire)
      @filename = filename || 'wonderfl_cache.db'
      @expire = expire || 0
      super(@filename)
    end

Public Instance Methods

[](key) click to toggle source

(Not documented)

# File lib/wonderfl/utils.rb, line 22
    def [](key)
      value = super(key) || {}
      expired = (value[:timestamp].nil? ||
                 value[:timestamp] + @expire < Time.now)
      expired ? nil : value[:entity]
    end
[]=(key, value) click to toggle source

(Not documented)

# File lib/wonderfl/utils.rb, line 29
    def []=(key, value)
      super(key, { 
            :entity => value,
            :timestamp => Time.now
            })
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.