class RedisConnection
Attributes
client[RW]
created[RW]
Public Class Methods
new(config)
click to toggle source
# File lib/cache_store_redis/redis_connection.rb, line 5 def initialize(config) self.client = Redis.new(config) self.created = Time.now end
Public Instance Methods
close()
click to toggle source
# File lib/cache_store_redis/redis_connection.rb, line 20 def close self.client.close self.created = nil end
expired?()
click to toggle source
This method is called to determine if this connection has been open for longer than the keep alive timeout or not.
# File lib/cache_store_redis/redis_connection.rb, line 11 def expired? return false if self.created.nil? Time.now >= (self.created + keep_alive_timeout) end
keep_alive_timeout()
click to toggle source
This method is called to get the keep alive timeout value to use for this connection.
# File lib/cache_store_redis/redis_connection.rb, line 26 def keep_alive_timeout Float(ENV['REDIS_KEEP_ALIVE_TIMEOUT'] || 30) end
open()
click to toggle source
# File lib/cache_store_redis/redis_connection.rb, line 16 def open self.created = Time.now if self.created.nil? end