class MODL::Parser::ObjectCache::CacheEntry

A cache record to keep track of the time since an object was last cached.

Constants

TTL_ONE_HOUR

Attributes

object[R]

Public Class Methods

new(object, ttl = nil) click to toggle source

Initialiase the CacheEntry with an object and an optional ttl in seconds (default 1 hour)

# File lib/modl/parser/object_cache.rb, line 36
def initialize(object, ttl = nil)
  ttl = TTL_ONE_HOUR if ttl.nil?
  @object = object
  @expiry_time = Time.now + ttl
end

Public Instance Methods

expired?() click to toggle source

Check whether the CacheEntry is live

# File lib/modl/parser/object_cache.rb, line 43
def expired?
  @expiry_time < Time.now
end