Sha256: 2d6d6a0f5eb26b0da01823c08b2522e4e51ec982cab1c18c45ec917764939b74
Contents?: true
Size: 896 Bytes
Versions: 1
Compression:
Stored size: 896 Bytes
Contents
require "redis" module Splash module Backends class Redis include Splash::Config def initialize(store) @config = get_config[:backends][:stores][store] @store = ::Redis.new :host => @config[:host], :port => @config[:port], :db => @config[:base].to_i @redis_cli_cmd = `which redis-cli` @store.auth(@config[:auth]) if @config[:auth] end def list(pattern='*') return @store.keys pattern end def get(options) return @store.get(options[:key]) end def put(options) @store.set options[:key], options[:value] end def del(options) @store.del options[:key] end def flush `#{@redis_cli_cmd} -n 3 flushdb` # @@store.flushdb end def exist?(options) return ( not @store.get(options[:key]).nil?) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prometheus-splash-0.0.3 | lib/splash/backends/redis.rb |