NoMethodError using Memcached Sinatra-style

Posted by sevennineteen on Stack Overflow See other posts from Stack Overflow or by sevennineteen
Published on 2010-06-03T11:30:18Z Indexed on 2010/06/03 11:34 UTC
Read the original article Hit count: 177

Filed under:
|
|
|

I've just installed Memcached on my Mac and updated my Sinatra app configuration as described in Heroku's documentation, but I'm getting a NoMethodError when trying to use the hash-based syntax they specify:

>> CACHE['color'] = 'blue'
>> CACHE['color']

Using explicit get and set methods as below seems to work fine.

>> CACHE.set('color', 'blue')
>> CACHE.get('color')

If necessary I can use the latter syntax, but the former seems more elegant. I haven't tested this on Heroku's environment since I'd like whatever implementation I use to work on my local environment as well. Thanks!

© Stack Overflow or respective owner

Related posts about ruby

Related posts about memcached