lib/newrelic-management/util.rb
def cachier(label, time = 30, &block)
      var = "@_cachier_#{label}"
      cache = instance_variable_get(var) || {}
      return cache['data'] if cache['timestamp'] && Time.now <= cache['timestamp'] + time
      cache['timestamp'] = Time.now
      cache['data'] = block.yield
      instance_variable_set(var, cache)
      cache['data']
    end
def cachier(label, time = 30, &block)
      var = "@_cachier_#{label}"
      cache = instance_variable_get(var) || {}
      return cache['data'] if cache['timestamp'] && Time.now <= cache['timestamp'] + time
      cache['timestamp'] = Time.now
      cache['data'] = block.yield
      instance_variable_set(var, cache)
      cache['data']
    end
def cachier ( label , time = 30 , & block ) var = "@_cachier_#{label}" cache = instance_variable_get ( var ) || { } return cache [ 'data' ] if cache [ 'timestamp' ] && Time . now <= cache [ 'timestamp' ] + time cache [ 'timestamp' ] = Time . now cache [ 'data' ] = block . yield instance_variable_set ( var , cache ) cache [ 'data' ] end
=>    Cache    <= 

 => Cache Return of a Function
= > Cache < =