redis_support 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/redis_support.rb +12 -7
- metadata +4 -13
data/lib/redis_support.rb
CHANGED
@@ -13,17 +13,25 @@ module RedisSupport
|
|
13
13
|
# 1. A 'hostname:port' string
|
14
14
|
# 2. A 'hostname:port:db' string (to select the Redis db)
|
15
15
|
# 3. An instance of `Redis`, `Redis::Client`
|
16
|
-
def redis=(connection)
|
16
|
+
def self.redis=(connection)
|
17
17
|
if connection.respond_to? :split
|
18
18
|
host, port, db = connection.split(':')
|
19
|
-
|
19
|
+
@redis = Redis.new(:host => host,:port => port,:thread_safe => true,:db => db)
|
20
20
|
else
|
21
|
-
|
21
|
+
@redis = connection
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.redis
|
26
|
+
@redis
|
27
|
+
end
|
28
|
+
|
29
|
+
def redis=(redis)
|
30
|
+
@redis = redis
|
31
|
+
end
|
32
|
+
|
25
33
|
def redis
|
26
|
-
|
34
|
+
@redis || RedisSupport.redis
|
27
35
|
end
|
28
36
|
|
29
37
|
def keys
|
@@ -35,8 +43,5 @@ module RedisSupport
|
|
35
43
|
def self.included(model)
|
36
44
|
model.extend ClassMethods
|
37
45
|
model.extend RedisSupport
|
38
|
-
model.redis = @redis
|
39
46
|
end
|
40
|
-
|
41
|
-
extend self
|
42
47
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 25
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Brian P O'Rourke
|
@@ -16,18 +15,16 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-23 00:00:00 -07:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: redis
|
24
23
|
prerelease: false
|
25
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
25
|
requirements:
|
28
26
|
- - ">="
|
29
27
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 31
|
31
28
|
segments:
|
32
29
|
- 1
|
33
30
|
- 0
|
@@ -48,8 +45,6 @@ files:
|
|
48
45
|
- lib/redis_support/class_extensions.rb
|
49
46
|
- lib/redis_support/locks.rb
|
50
47
|
- README.md
|
51
|
-
- test/helper.rb
|
52
|
-
- test/test_redis_support.rb
|
53
48
|
has_rdoc: true
|
54
49
|
homepage: http://github.com/dolores/redis_support
|
55
50
|
licenses: []
|
@@ -60,27 +55,23 @@ rdoc_options:
|
|
60
55
|
require_paths:
|
61
56
|
- lib
|
62
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
58
|
requirements:
|
65
59
|
- - ">="
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
hash: 3
|
68
61
|
segments:
|
69
62
|
- 0
|
70
63
|
version: "0"
|
71
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
65
|
requirements:
|
74
66
|
- - ">="
|
75
67
|
- !ruby/object:Gem::Version
|
76
|
-
hash: 3
|
77
68
|
segments:
|
78
69
|
- 0
|
79
70
|
version: "0"
|
80
71
|
requirements: []
|
81
72
|
|
82
73
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.3.
|
74
|
+
rubygems_version: 1.3.6
|
84
75
|
signing_key:
|
85
76
|
specification_version: 3
|
86
77
|
summary: A Redis Support module
|