unified-redis 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/unified-redis.rb +1 -0
- data/lib/unified_redis/adapter.rb +18 -0
- data/lib/unified_redis/adapters/emredis.rb +13 -0
- data/lib/unified_redis/adapters/redis.rb +15 -0
- data/lib/unified_redis/core.rb +13 -0
- data/lib/unified_redis/version.rb +3 -0
- data/lib/unified_redis.rb +8 -0
- metadata +109 -0
@@ -0,0 +1 @@
|
|
1
|
+
require 'unified_redis'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module UnifiedRedis
|
2
|
+
module Adapter
|
3
|
+
# List of available adapters
|
4
|
+
def self.adapters
|
5
|
+
{
|
6
|
+
'Redis' => "Redis",
|
7
|
+
'EventMachine::Protocols::Redis::EM_CONNECTION_CLASS' => 'EMRedis'
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.get_adapter(redis)
|
12
|
+
adapter = self.adapters[redis.class.to_s]
|
13
|
+
raise "Adapter not found" if adapter.nil?
|
14
|
+
require "unified_redis/adapters/#{adapter.downcase}"
|
15
|
+
Adapter.const_get(adapter).new(redis)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module UnifiedRedis
|
2
|
+
class Core
|
3
|
+
def initialize(redis)
|
4
|
+
@redis = redis
|
5
|
+
@adapter = Adapter.get_adapter(redis)
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_missing(command, *args, &block)
|
9
|
+
#return unless @redis.respond_to?(command.to_sym)
|
10
|
+
@adapter.call(command, *args, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unified-redis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- François de Metz
|
9
|
+
- Jean-Denis Vauguet
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-10-24 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: eventmachine
|
17
|
+
requirement: &13506000 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.0.beta
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *13506000
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bundler
|
28
|
+
requirement: &13539940 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *13539940
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
requirement: &13539480 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *13539480
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: redis
|
50
|
+
requirement: &13539060 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *13539060
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: em-redis
|
61
|
+
requirement: &13538640 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *13538640
|
70
|
+
description: An unified redis interface for redis-rb and em-redis.
|
71
|
+
email:
|
72
|
+
- fdemetz@af83.com
|
73
|
+
- jdvauguet@af83.com
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- lib/unified-redis.rb
|
79
|
+
- lib/unified_redis.rb
|
80
|
+
- lib/unified_redis/adapter.rb
|
81
|
+
- lib/unified_redis/adapters/emredis.rb
|
82
|
+
- lib/unified_redis/adapters/redis.rb
|
83
|
+
- lib/unified_redis/core.rb
|
84
|
+
- lib/unified_redis/version.rb
|
85
|
+
homepage: https://github.com/af83/unified-redis
|
86
|
+
licenses: []
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.8.6
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: An unified redis interface for redis-rb and em-redis.
|
109
|
+
test_files: []
|