class Vop::CacheWrapper
Attributes
data[R]
options[R]
timestamp[R]
Public Class Methods
from_json(string)
click to toggle source
# File extended/redis_cache/helpers/cache_wrapper.rb, line 27 def self.from_json string return if string.nil? payload = JSON.load(string) self.new(payload["data"], payload["options"], payload["timestamp"]) end
new(data, options = {}, timestamp = nil)
click to toggle source
# File extended/redis_cache/helpers/cache_wrapper.rb, line 7 def initialize(data, options = {}, timestamp = nil) @data = data @options = options @timestamp = timestamp || Time.now end
Public Instance Methods
to_json()
click to toggle source
# File extended/redis_cache/helpers/cache_wrapper.rb, line 13 def to_json begin JSON.generate({ "options" => options, "data" => data, "timestamp" => @timestamp.to_i }) rescue => detail $logger.warn("problem generating JSON : #{detail.message}") $logger.debug("offending payload : #{data.pretty_inspect}") raise detail end end