class Cachetastic::Adapters::Redis
Public Class Methods
new(klass)
click to toggle source
Calls superclass method
Cachetastic::Adapters::Base::new
# File lib/cachetastic/adapters/redis.rb, line 5 def initialize(klass) define_accessor(:redis_host) define_accessor(:redis_options) define_accessor(:delete_delay) super self.redis_host ||= "redis://localhost:6379/" parsed_url = URI.parse(self.redis_host) self.redis_options = ::Redis::Client::DEFAULTS.merge({ db: "cachetastic", url: self.redis_host, scheme: parsed_url.scheme, host: parsed_url.host, port: parsed_url.port, password: parsed_url.password }) self.marshal_method = :yaml if self.marshal_method == :none connection end
Public Instance Methods
valid?()
click to toggle source
# File lib/cachetastic/adapters/redis.rb, line 46 def valid? !connection.nil? end
Private Instance Methods
connection()
click to toggle source
# File lib/cachetastic/adapters/redis.rb, line 51 def connection if @connection.nil? @connection = ::Redis.new(self.redis_options) end return @connection end