Sha256: 8fe00032186ebe83c0da8cfd3534d57570ff7c703e5179f1880f7d00bd1b5929
Contents?: true
Size: 616 Bytes
Versions: 1
Compression:
Stored size: 616 Bytes
Contents
require 'redis' module Skalera module Services class Redis def self.instance(database=0) redis_config = Diplomat::Service.get('redis') redis = ::Redis.new(url: url(password, redis_config.Address, redis_config.ServicePort, database)) at_exit { redis.quit } redis end def self.url(password, host, port, database) pwd = password ? "#{password}:" : '' "redis://#{pwd}#{host}:#{port}/#{database}" end def self.password Diplomat.get('redis/password') rescue Diplomat::KeyNotFound nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
skalera-services-0.1.0 | lib/skalera/services/redis.rb |