rediska 0.2.3 → 0.2.4

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: 919caed5a31e25a55da2f469c2edc1c547324bfc
4
- data.tar.gz: c85a871a9c4713e1a57b789ef5cb9e27a1241d89
3
+ metadata.gz: 283b4794356ce0621210f764ebb2c8d824a99b3f
4
+ data.tar.gz: 87edc5b82728ffecac2c8380ed6dac8e23269801
5
5
  SHA512:
6
- metadata.gz: fed6d70e8c5864712501cb2301297aea5be21a0eb5df1b0a355a9740bcfce7d3164e27257a864f9b31094941934ae6b4b6922155fa374458d8f0b0ccd76fad09
7
- data.tar.gz: f8518a36ca7b79adc805c090afd6af06cdb4b6981bcee3ad208c75236e59b7edc79078964e851799abe84fb48ad1bdd631b20872c547e50a826f48048aa67654
6
+ metadata.gz: 3b17ebdc0561438c703038be21031965b1dcf467f22f9d90244fa5905c18df8ba140ef53021d176a84dbb58b1e582e0731dad9fe69e87d7f84711451277347cc
7
+ data.tar.gz: ad36e7b58c2d4ed202ad44abe19f68946c20af64722c990eb77f3f68a36824fcefcfac290a2f917629f1b3b51d25240fb02b3472c7f4d3b1096df9029832e334
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rediska (0.2.3)
4
+ rediska (0.2.4)
5
5
  redis (>= 3)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -105,6 +105,7 @@ end
105
105
  * HVALS
106
106
  * INCR
107
107
  * INCRBY
108
+ * INCRBYFLOAT
108
109
  * INFO
109
110
  * KEYS
110
111
  * LASTSAVE
@@ -123,8 +124,11 @@ end
123
124
  * MSETNX
124
125
  * MULTI
125
126
  * PERSIST
127
+ * PEXPIRE
126
128
  * PING
129
+ * PTTL
127
130
  * RANDOMKEY
131
+ * REDIS
128
132
  * RENAME
129
133
  * RENAMENX
130
134
  * RESTORE
@@ -727,6 +727,11 @@ module Rediska
727
727
  data[key].to_i
728
728
  end
729
729
 
730
+ def incrbyfloat(key, by)
731
+ data.merge!({ key => (data[key].to_f + by.to_f).to_s || by })
732
+ data[key]
733
+ end
734
+
730
735
  def decr(key)
731
736
  data.merge!({ key => (data[key].to_i - 1).to_s || '-1'})
732
737
  data[key].to_i
@@ -1,3 +1,3 @@
1
1
  module Rediska
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.2.4'.freeze
3
3
  end
@@ -71,7 +71,7 @@ shared_examples 'keys' do
71
71
  it "should set a key's time to live in miliseconds" do
72
72
  subject.set('key1', '1')
73
73
  subject.pexpire('key1', 2200)
74
- expect(subject.pttl('key1')).to be_within(0.5).of(2200)
74
+ expect(subject.pttl('key1')).to be_within(1).of(2200)
75
75
  end
76
76
 
77
77
  it 'should set the expiration for a key as a UNIX timestamp' do
@@ -129,6 +129,12 @@ shared_examples 'strings' do
129
129
  expect(subject.get('counter')).to eq('17')
130
130
  end
131
131
 
132
+ it 'should increment the float value of a key by the given number' do
133
+ subject.set('counter', 10.0)
134
+ expect(subject.incrbyfloat('counter', 2.1)).to eq(12.1)
135
+ expect(subject.get('counter')).to eq('12.1')
136
+ end
137
+
132
138
  it 'should not change the expire value of the key during incrby' do
133
139
  subject.set('counter', '1')
134
140
  expect(subject.expire('counter', 600)).to be_truthy
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.2.3
4
+ version: 0.2.4
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-11-24 00:00:00.000000000 Z
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis