Class: Redis::Store

Inherits:
Redis
  • Object
show all
Includes:
Interface, RedisVersion, Ttl
Defined in:
lib/redis/store.rb,
lib/redis/store/ttl.rb,
lib/redis/store/factory.rb,
lib/redis/store/version.rb,
lib/redis/store/interface.rb,
lib/redis/store/namespace.rb,
lib/redis/store/redis_version.rb,
lib/redis/store/serialization.rb

Defined Under Namespace

Modules: Interface, Namespace, RedisVersion, Serialization, Ttl Classes: Factory

Constant Summary collapse

VERSION =
'1.8.2'

Instance Method Summary collapse

Methods included from Ttl

#set, #setnx

Methods included from Interface

#get, #set, #setex, #setnx

Methods included from RedisVersion

#redis_version, #supports_redis_version?

Constructor Details

#initialize(options = {}) ⇒ Store

Returns a new instance of Store.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/redis/store.rb', line 16

def initialize(options = {})
  super

  unless options[:marshalling].nil?
    puts %(
      DEPRECATED: You are passing the :marshalling option, which has been
      replaced with `serializer: Marshal` to support pluggable serialization
      backends. To disable serialization (much like disabling marshalling),
      pass `serializer: nil` in your configuration.

      The :marshalling option will be removed for redis-store 2.0.
    )
  end

  @serializer = options.key?(:serializer) ? options[:serializer] : Marshal

  unless options[:marshalling].nil?
    @serializer = options[:marshalling] ? Marshal : nil
  end

  _extend_marshalling options
  _extend_namespace   options
end

Instance Method Details

#locationObject



48
49
50
51
52
53
54
55
56
# File 'lib/redis/store.rb', line 48

def location
  if @client.path
    @client.path
  else
    h = @client.host
    h = "[#{h}]" if h.include?(":")
    "#{h}:#{@client.port}"
  end
end

#reconnectObject



40
41
42
# File 'lib/redis/store.rb', line 40

def reconnect
  @client.reconnect
end

#to_sObject



44
45
46
# File 'lib/redis/store.rb', line 44

def to_s
  "Redis Client connected to #{location} against DB #{@client.db}"
end