Skip to content

Commit 997d2f7

Browse files
AlexDWuCh4s3
authored andcommitted
Set Redis keys only if they don't exist (#156)
1 parent df7a12f commit 997d2f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/classifier-reborn/backends/bayes_redis_backend.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def initialize(options = {})
3434
end
3535

3636
@redis = Redis.new(options)
37-
@redis.set(:total_words, 0)
38-
@redis.set(:total_trainings, 0)
37+
@redis.setnx(:total_words, 0)
38+
@redis.setnx(:total_trainings, 0)
3939
end
4040

4141
def total_words

0 commit comments

Comments
 (0)