Sha256: ede057f1836d3e9e7d3a9b29068564e78c04bfa7325867844900b6ad3924fa85
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# require "active_support" require "active_record" require "redis" require "pp" # The Ampere module contains methods to connect/disconnect and gives access to # the Redis connection directly (though you really shouldn't need to use it). module Ampere @@connection = nil # Open a new Redis connection. `options` is passed directly to the Redis.connect # method. def self.connect(options = {}) @@connection = Redis.connect(options) end # Closes the Redis connection. def self.disconnect return unless connected? @@connection.quit @@connection = nil end # Returns `true` if the Redis connection is active. def self.connected? !! @@connection end # Gives access to the Redis connection object. def self.connection @@connection end # Alias for Ampere.redis.flushall def self.flush @@connection.flushall if connected? end end Dir[File.join(File.dirname(__FILE__), 'ampere', '**', '*.rb')].each {|f| require f} require File.join(File.dirname(__FILE__), "rails", "railtie.rb") if defined?(Rails)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ampere-1.2.1 | lib/ampere.rb |
ampere-1.2.0 | lib/ampere.rb |