rediska 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e4ac28eb56bf3a2cab47dc9b091b7182acc88b8
4
- data.tar.gz: 5d6d48bc843232644fbfbf92063a7785a6db947e
3
+ metadata.gz: dd18585f05fa32a32467fc94d32a86721f605229
4
+ data.tar.gz: 33abc1203b205f9a67020ce205223c642c054d4a
5
5
  SHA512:
6
- metadata.gz: 7b149f856ed62eb989464acdf464424d2c870a752b5e00014e0e83b7c3cb48c66a375d819a792641b7989f19868dc60d5f6b86d7f89a4f5ce335d5e0d8255b99
7
- data.tar.gz: 5c5cfffc7e706fe27dee1ea447d36a9c58cff8f63e906060c516f1c9e4b4d190f618cc79a2b4746ae464091231e2a3aa521ae4192ab7eddd3307a8febb994971
6
+ metadata.gz: 9c6bcc3c79b86e2a5df2686e4b3a57e6c9093384f24bc6282aa18d8fffe842523f1b29609281e80b05ff2b37240d49e147b9e06dbddfd18b26e9e7063a56c585
7
+ data.tar.gz: fd8b78d827d350b5c63c0b6c49a5087fed940bd467e629870bf601ab8a49e428f44ce19f5d9902ce3514c512824454e3e264ca7dba24b73cb61265af8c549a34
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rediska (0.1.0)
4
+ rediska (0.1.1)
5
5
  redis (~> 3.0.0)
6
6
 
7
7
  GEM
@@ -197,14 +197,14 @@ module Rediska
197
197
  data_type_check(key, Array)
198
198
  return unless data[key]
199
199
 
200
- if start < 0 && data[key].count < start.abs
201
- # Example: we have a list of 3 elements and we give it a ltrim list, -5, -1. This means it
202
- # should trim to a max of 5. Since 3 < 5 we should not touch the list. This is consistent
203
- # with behavior of real Redis's ltrim with a negative start argument.
204
- data[key]
205
- else
200
+ # Example: we have a list of 3 elements and we give it a ltrim list, -5, -1. This means it
201
+ # should trim to a max of 5. Since 3 < 5 we should not touch the list. This is consistent
202
+ # with behavior of real Redis's ltrim with a negative start argument.
203
+ unless start < 0 && data[key].count < start.abs
206
204
  data[key] = data[key][start..stop]
207
205
  end
206
+
207
+ 'OK'
208
208
  end
209
209
 
210
210
  def lindex(key, index)
@@ -441,9 +441,9 @@ module Rediska
441
441
  end
442
442
 
443
443
  def expire(key, ttl)
444
- return unless data[key]
444
+ return 0 unless data[key]
445
445
  data.expires[key] = Time.now + ttl
446
- true
446
+ 1
447
447
  end
448
448
 
449
449
  def ttl(key)
@@ -1,3 +1,3 @@
1
1
  module Rediska
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
data/spec/support/keys.rb CHANGED
@@ -26,6 +26,15 @@ shared_examples 'keys' do
26
26
  }.to raise_error(Redis::CommandError)
27
27
  end
28
28
 
29
+ it 'should return true when setting expires on keys that exist' do
30
+ subject.set('key1', '1')
31
+ expect(subject.expire('key1', 1)).to be_truthy
32
+ end
33
+
34
+ it 'should return false when attempting to set expires on a key that does not exist' do
35
+ expect(subject.expire('key1', 1)).to be_falsey
36
+ end
37
+
29
38
  it 'should determine if a key exists' do
30
39
  subject.set('key1', '1')
31
40
 
@@ -117,7 +117,7 @@ shared_examples 'lists' do
117
117
  subject.rpush('key1', 'two')
118
118
  subject.rpush('key1', 'three')
119
119
 
120
- subject.ltrim('key1', 1, -1)
120
+ expect(subject.ltrim('key1', 1, -1)).to eq('OK')
121
121
  expect(subject.lrange('key1', 0, -1)).to eq(['two', 'three'])
122
122
  end
123
123
 
@@ -13,10 +13,11 @@ shared_examples 'transactions' do
13
13
  transaction = subject.multi do |multi|
14
14
  multi.set('key1', '1')
15
15
  multi.set('key2', '2')
16
+ multi.expire('key1', 123)
16
17
  multi.mget('key1', 'key2')
17
18
  end
18
19
 
19
- expect(transaction).to eq(['OK', 'OK', ['1', '2']])
20
+ expect(transaction).to eq(['OK', 'OK', true, ['1', '2']])
20
21
  end
21
22
  end
22
23
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rediska
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Beder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis