Memcached sessions and Facebook
Memcached makes an excellent session store for Facebook applications. Unfortunately, it doesn't work out of the box with Facebooker. See how to fix that inside.
By default, the Memcached session store doesn't allow session keys with dashes in them. Since Facebook session identifiers include a dash, this causes an immediate error. Luckily, there is a simple fix. Add the following code as either an initializer or to your environment.rb file to get your Facebooker sessions running with memcached.
# add - as an okay key class CGI class Session class MemCacheStore def check_id(id) #:nodoc:# /[^0-9a-zA-Z-]+/ =~ id.to_s ? false : true end end end end
Don't you love simple solutions to annoying problems?
Posted by Mike Mangino on Friday, July 25, 2008