redic 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e1b0f1a2333c422e952095844a76b768a5da377
4
- data.tar.gz: dee6f7ad9a8fe7e5af893c6b66dfb57cbd02f6e2
3
+ metadata.gz: 5bbf2e9c0a04c38c2fedc078ec27d1f92f5c6d4d
4
+ data.tar.gz: 9e58dc7004c43eceee2d4207551bd48aad7ecebb
5
5
  SHA512:
6
- metadata.gz: e3bdf533b10694796c510b8ee47f16f43db20ae7a83cc2648b9a61779a2392b46ca811a681513a32e16d5d5894c8a66d835fa3957e47f1b6763a458ff8c37d85
7
- data.tar.gz: 4a0a0ceaf7d311f9164fa900acade5fe75f0be7aa8355ca29d6aa62a50685390948dbcd88d97437148ae529f86d2828cc15d7a83a67ce1ff25a8d71e6ac6f42e
6
+ metadata.gz: 89892ba684ac2c9ca56d433feadf3871d3dd89a541e850fe717bf9c067e6e0d84730f73f7e9d7dfde5b3ca950ef173a22c461356eedf7e4a5c09abab101bd1d7
7
+ data.tar.gz: 268b97ee191a5092dc63ca8658cc5af6eaf66ebf75413119e7255643300934c0554ca18bcf592c2f64d15927264b7813c70d98a8a81031866bf37c21b51779a5
data/README.md CHANGED
@@ -6,9 +6,8 @@ Lightweight Redis Client
6
6
  Description
7
7
  -----------
8
8
 
9
- Lightweight Redis Client inspired by
10
- [redigo](https://github.com/garyburd/redigo), a Redis client
11
- library for golang.
9
+ Lightweight Redis Client inspired by [redigo][redigo], a Redis
10
+ client library for golang.
12
11
 
13
12
  ## Usage
14
13
 
@@ -23,10 +22,10 @@ assert_equal "bar", redis.call("GET", "foo")
23
22
 
24
23
  # Pipelining is implemented by buffering commands,
25
24
  # then calling Redic#run
26
- redis.pipe("SET", "foo", "bar")
27
- redis.pipe("GET", "foo")
25
+ redis.queue("SET", "foo", "bar")
26
+ redis.queue("GET", "foo")
28
27
 
29
- assert_equal ["OK", "bar"], redis.run
28
+ assert_equal ["OK", "bar"], redis.commit
30
29
  ```
31
30
 
32
31
  ## Differences with redis-rb
@@ -39,6 +38,10 @@ than that of redis-rb, as it only wraps the writing and reading from
39
38
  the connection. So even if both clients are thread-safe by default,
40
39
  the peformance of a smaller lock is marginally better.
41
40
 
41
+ [redigo]: https://github.com/garyburd/redigo
42
+ [hiredis]: https://github.com/pietern/hiredis-rb
43
+ [redis-rb]: https://github.com/redis/redis-rb
44
+
42
45
  ## Limitations
43
46
 
44
47
  When a client enters a subscribed mode, further reads to retrieve the
data/lib/redic/client.rb CHANGED
@@ -5,7 +5,6 @@ class Redic
5
5
  class Client
6
6
  def initialize(url)
7
7
  @uri = URI.parse(url)
8
- @ttl = Integer(ENV.fetch("REDIC_TTL", 60))
9
8
  @connection = nil
10
9
  @semaphore = Mutex.new
11
10
  end
@@ -20,7 +19,6 @@ class Redic
20
19
 
21
20
  def connect
22
21
  establish_connection unless connected?
23
- timestamp_connection
24
22
 
25
23
  @semaphore.synchronize do
26
24
  yield
@@ -41,10 +39,6 @@ class Redic
41
39
  authenticate
42
40
  end
43
41
 
44
- def timestamp_connection
45
- @timestamp = Time.now.to_i
46
- end
47
-
48
42
  def authenticate
49
43
  if @uri.password
50
44
  @semaphore.synchronize do
@@ -55,11 +49,7 @@ class Redic
55
49
  end
56
50
 
57
51
  def connected?
58
- @connection && @connection.connected? && alive?
59
- end
60
-
61
- def alive?
62
- Time.now.to_i - @timestamp < @ttl
52
+ @connection && @connection.connected?
63
53
  end
64
54
  end
65
55
  end
data/redic.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "redic"
5
- s.version = "0.0.7"
5
+ s.version = "0.0.8"
6
6
  s.summary = "Lightweight Redis Client"
7
7
  s.description = "Lightweight Redis Client"
8
8
  s.authors = ["Michel Martens", "Cyril David"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-25 00:00:00.000000000 Z
12
+ date: 2013-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hiredis