class Lemondrop::Plugin::Service
Public Class Methods
establish_connection(params)
click to toggle source
Start the connection to the configured Redis server
@param params [Hash] Options to establish the Redis connection
# File lib/lemondrop/plugin/service.rb, line 34 def establish_connection(params) connection = ::Redis.new params logger.info "Lemondrop connected to Redis at #{params[:host]}:#{params[:port]}" connection end
start(config)
click to toggle source
Start the Redis connection with the configured database
# File lib/lemondrop/plugin/service.rb, line 10 def start(config) params = config.to_hash.select { |k,v| !v.nil? } unless params[:uri].nil? || params[:uri].empty? uri = URI.parse params[:uri] params[:username] = uri.user params[:password] = uri.password params[:hostname] = uri.hostname params[:port] = uri.port || params[:port] params.delete :uri end @@connection = establish_connection params end
stop()
click to toggle source
Stop the redis connection
# File lib/lemondrop/plugin/service.rb, line 26 def stop logger.warn "Todo: Close down Redis connections" end