Skip to content

Commit

Permalink
Remove unnecessary Redis command for Counter (#130)
Browse files Browse the repository at this point in the history
* Remove unnecessary Redis command for Counter

* Fix rubocop for README
Broken by: rails/rails@a7ee313

---------

Co-authored-by: Pavel Guseynov <pavel@didlogic.com>
  • Loading branch information
Pavel-Guseynov and Pavel Guseynov committed Oct 19, 2023
1 parent cc15c2f commit 1da4608
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ A development console is available by running `bin/console`.

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

```rb
```erb
>> str = Kredis.string "mystring"
Kredis (0.1ms) Connected to shared
=>
Expand Down
4 changes: 2 additions & 2 deletions lib/kredis/types/counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ class Kredis::Types::Counter < Kredis::Types::Proxying

def increment(by: 1)
multi do
set 0, ex: expires_in, nx: true
set 0, ex: expires_in, nx: true if expires_in
incrby by
end[-1]
end

def decrement(by: 1)
multi do
set 0, ex: expires_in, nx: true
set 0, ex: expires_in, nx: true if expires_in
decrby by
end[-1]
end
Expand Down

0 comments on commit 1da4608

Please sign in to comment.