Sha256: 354e47100e6268c0b5f6ca233a8eb729328788e6cc01fcb6785beccd7428a8ee
Contents?: true
Size: 580 Bytes
Versions: 3
Compression:
Stored size: 580 Bytes
Contents
module KJess class StatsCache attr_reader :last_stat_time attr_reader :expiration attr_reader :client def initialize( client, expiration = 0 ) @client = client @expiration = expiration @last_stat_time = Time.at( 0 ) @stats = nil end def expiration_time last_stat_time + expiration end def expired? Time.now > expiration_time end def stats if expired? then @stats = client.stats! @last_stat_time = Time.now end return @stats end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kjess-1.2.0 | lib/kjess/stats_cache.rb |
kjess-1.1.0 | lib/kjess/stats_cache.rb |
kjess-1.0.0 | lib/kjess/stats_cache.rb |