Skip to content

Commit 1da4608

Browse files
Pavel-GuseynovPavel Guseynov
andauthored
Remove unnecessary Redis command for Counter (#130)
* Remove unnecessary Redis command for Counter * Fix rubocop for README Broken by: rails/rails@a7ee313 --------- Co-authored-by: Pavel Guseynov <[email protected]>
1 parent cc15c2f commit 1da4608

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ A development console is available by running `bin/console`.
292292

293293
From there, you can experiment with Kredis. e.g.
294294

295-
```rb
295+
```erb
296296
>> str = Kredis.string "mystring"
297297
Kredis (0.1ms) Connected to shared
298298
=>

lib/kredis/types/counter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ class Kredis::Types::Counter < Kredis::Types::Proxying
99

1010
def increment(by: 1)
1111
multi do
12-
set 0, ex: expires_in, nx: true
12+
set 0, ex: expires_in, nx: true if expires_in
1313
incrby by
1414
end[-1]
1515
end
1616

1717
def decrement(by: 1)
1818
multi do
19-
set 0, ex: expires_in, nx: true
19+
set 0, ex: expires_in, nx: true if expires_in
2020
decrby by
2121
end[-1]
2222
end

0 commit comments

Comments
 (0)