class MemcachePod::MemoryEntry
Public Class Methods
new(body,ttl)
click to toggle source
# File lib/memcachepod/memory_entry.rb, line 9 def initialize(body,ttl) @reference = false @body = body @expires_in = expires_in(ttl) end
Public Instance Methods
body()
click to toggle source
# File lib/memcachepod/memory_entry.rb, line 20 def body() @reference = true return @body end
expired?()
click to toggle source
# File lib/memcachepod/memory_entry.rb, line 25 def expired?() if 0 < @expires_in now = Time.now.to_i #second return @expires_in < now else return false end end
get_status()
click to toggle source
# File lib/memcachepod/memory_entry.rb, line 34 def get_status exp = 0 if 0 < @expires_in exp = @expires_in - Time.now.to_i end return { 'reference' => @reference, 'expires_in' => exp, 'bodysize' => @body.size } end
update(body,ttl)
click to toggle source
# File lib/memcachepod/memory_entry.rb, line 15 def update(body,ttl) @body = body @expires_in = expires_in(ttl) end
Private Instance Methods
expires_in(ttl)
click to toggle source
# File lib/memcachepod/memory_entry.rb, line 48 def expires_in(ttl) if 0 < ttl now = Time.now.to_i #second return now + ttl end return 0 end