Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Bug in increment? #290

simo2409 opened this Issue · 3 comments

3 participants


I have troubles using increment, it returns nil and it doesn't update value in memcached, I can't understand if I'm wronging something or if there is a bug.

1.9.3p194 :001 >'foo')
=> nil
1.9.3p194 :002 > Rails.cache.write('foo', 1)
=> true
1.9.3p194 :003 >'foo')
=> 1
1.9.3p194 :004 > Rails.cache.increment('foo', 1)
=> nil
1.9.3p194 :005 >'foo')
=> 1

I would expect after .increment to have 'foo' = 2

Thank you


I copied your commands and got the expected result. Are you still having this problem?


yes the problem is still there (I also updated to Dalli 2.5.0 but nothing changed)

I'm doing this inside rails console using rails 3.2.9 running on ruby 1.9.3p327 (if it can be useful to understand where the problem is)


You do not read or write incremented values, this is not legal in memcached. You use increment(value, 1) to increment the counter and use increment(value, 0) to read the current value.

@mperham mperham closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.