Sha256: 9084727e16c52fdb1b08b17299d8f33ef270f3b26abbe4bf36abbacaca81aa6a

Contents?: true

Size: 645 Bytes

Versions: 24

Compression:

Stored size: 645 Bytes

Contents

class Cachetastic::Adapters::StoreObject #:nodoc:#
  attr_accessor :key
  attr_accessor :value
  attr_accessor :expires_at
  
  def initialize(key, value, expiry)
    self.key = key
    self.value = value
    begin
      self.expires_at = (Time.now + (expiry == 0 ? (31536000) : expiry)) # 31536000 = one year
    rescue RangeError => e
      self.expires_at = Time.at(expiry)
    end
    # puts "now: #{Time.now}"
    # puts "expiry: #{expiry}"
    # puts "expires_at: #{self.expires_at}"
  end
  
  def size
    return self.value.size if self.value.respond_to?(:size)
    -1
  end
  
  def invalid?
    Time.now >= self.expires_at
  end
  
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
cachetastic-1.4.0 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.2.1 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.2.2 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.2.3 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.2.7.1 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.3.1 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.7.2 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.7.4 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.4.1 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.4.2 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.5.0 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.6.0 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.7.0 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.3.0 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-1.7.3 lib/adapters/cachetastic_adapters_store_object.rb
cachetastic-2.1.1 lib/cachetastic/adapters/store_object.rb
cachetastic-2.0.0 lib/cachetastic/adapters/store_object.rb
cachetastic-2.1.0 lib/cachetastic/adapters/store_object.rb
cachetastic-2.1.2 lib/cachetastic/adapters/store_object.rb
cachetastic-2.1.3 lib/cachetastic/adapters/store_object.rb