I am trying to save all response.body to memcached. I do it like this:
Rails.cache.write(request.headers['HTTP_X_MEMCACHED_KEY'], response.body)
The problem is that it adds some garbage to the value:
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1355928410.584484:@value"GsI";s<!DOCTYPE html>...
I tried passing :raw => true to Rails.cache.write , but it returns false and does not put the value in memcached. I think this fails because response.body failed to escape.
I also tried like this:
Rails.cache.write(request.headers['HTTP_X_MEMCACHED_KEY'], Marshal.dump(response.body), :raw => true)
It works, but there is still garbage in it:
I"fD<!DOCTYPE html>...
How to put net worth in memcached?
source share