relix 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -0
- data/lib/relix/redis.rb +5 -1
- data/lib/relix/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -27,6 +27,13 @@ Otherwise gem install:
|
|
27
27
|
|
28
28
|
$ gem install relix
|
29
29
|
|
30
|
+
You can configure the Redis host, port and db like so:
|
31
|
+
|
32
|
+
Relix.host = 'app-1'
|
33
|
+
Relix.port = 10000
|
34
|
+
Relix.db = 5
|
35
|
+
|
36
|
+
|
30
37
|
## Usage
|
31
38
|
|
32
39
|
To index something in a model, include the Relix module, declare the primary key (required), and declare any additional indexes you want:
|
data/lib/relix/redis.rb
CHANGED
@@ -4,7 +4,7 @@ require 'redis'
|
|
4
4
|
module Relix
|
5
5
|
def self.redis
|
6
6
|
unless @redis
|
7
|
-
@redis = ::Redis.new(port: @redis_port)
|
7
|
+
@redis = ::Redis.new(host: @redis_host, port: @redis_port)
|
8
8
|
@redis.select @redis_db if @redis_db
|
9
9
|
end
|
10
10
|
if block_given?
|
@@ -14,6 +14,10 @@ module Relix
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.host=(value)
|
18
|
+
@redis_host = value
|
19
|
+
end
|
20
|
+
|
17
21
|
def self.port=(value)
|
18
22
|
@redis_port = value
|
19
23
|
end
|
data/lib/relix/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-04 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hiredis
|
16
|
-
requirement: &
|
16
|
+
requirement: &70142201829740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.4.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70142201829740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redis
|
27
|
-
requirement: &
|
27
|
+
requirement: &70142201828000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 2.2.2
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70142201828000
|
36
36
|
description: ! 'Relix is a layer that can be added on to any model to make all the
|
37
37
|
normal types of querying you want to do: equality, less than/greater than, in set,
|
38
38
|
range, limit, etc., quick and painless. Relix depends on Redis to be awesome at
|