class SeleniumGridConsoleParser::Nodes::GridNodeCacheData
Public Class Methods
new(cache_duration_in_secs = 20)
click to toggle source
# File lib/nodes/data/grid_node_data.rb, line 25 def initialize(cache_duration_in_secs = 20) @max_seconds = cache_duration_in_secs @data = {} @time = 0 end
Public Instance Methods
read(key)
click to toggle source
# File lib/nodes/data/grid_node_data.rb, line 46 def read(key) @data[key] end
valid?()
click to toggle source
# File lib/nodes/data/grid_node_data.rb, line 31 def valid? time_difference = (Time.now - @time).to_i if time_difference > @max_seconds @data = {} return false else return true end end
write(key,value)
click to toggle source
# File lib/nodes/data/grid_node_data.rb, line 41 def write(key,value) @data[key] = value @time = Time.now end