ellen-redis 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -1
- data/lib/ellen/brains/redis.rb +5 -8
- data/lib/ellen/redis/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f4bf8ec90a1d2d6af4231688e49b2c27012b600
|
4
|
+
data.tar.gz: 3f6aed1e0833cb70dc57f8462bb1f5e081ff7402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03275c5e89dcaf93ec0b61773821c5f9c474277afb15c634115c32e08dd7e310e4a4cd49ed982153720540548d171145a1c14eb0a09e02cc1305089b09ba80ee
|
7
|
+
data.tar.gz: 2b99469cc849ea16c0cdc03af653284bf385792205394c0c094fb12ba79b775c3fbe0e146ba736cec7e791b2ba358eeb4cf25e4ca384f522d61b980057843f9c
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
data/lib/ellen/brains/redis.rb
CHANGED
@@ -11,22 +11,19 @@ module Ellen
|
|
11
11
|
|
12
12
|
attr_reader :thread
|
13
13
|
|
14
|
-
env :REDIS_URL, "Redis URL (e.g. redis://foo:bar@example.com:6379/"
|
14
|
+
env :REDIS_URL, "Redis URL (e.g. redis://foo:bar@example.com:6379/)"
|
15
15
|
env :REDIS_SAVE_INTERVAL, "Interval sec to push data to Redis (default: 5)", optional: true
|
16
16
|
|
17
17
|
def initialize
|
18
18
|
super
|
19
19
|
@thread = Thread.new { sync }
|
20
|
+
@thread.abort_on_exception = true
|
20
21
|
end
|
21
22
|
|
22
23
|
def data
|
23
24
|
@data ||= pull || {}
|
24
25
|
end
|
25
26
|
|
26
|
-
def save
|
27
|
-
push
|
28
|
-
end
|
29
|
-
|
30
27
|
private
|
31
28
|
|
32
29
|
def push
|
@@ -34,15 +31,15 @@ module Ellen
|
|
34
31
|
end
|
35
32
|
|
36
33
|
def pull
|
37
|
-
if
|
38
|
-
JSON.parse(
|
34
|
+
if data = client.get(KEY)
|
35
|
+
JSON.parse(data)
|
39
36
|
end
|
40
37
|
end
|
41
38
|
|
42
39
|
def sync
|
43
40
|
loop do
|
44
41
|
wait
|
45
|
-
|
42
|
+
push
|
46
43
|
end
|
47
44
|
end
|
48
45
|
|
data/lib/ellen/redis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ellen-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
@@ -88,6 +88,7 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
|
+
- CHANGELOG.md
|
91
92
|
- Gemfile
|
92
93
|
- LICENSE.txt
|
93
94
|
- README.md
|