caching - how to use memcache to speed-up rails/heroku -


heroku supports memcache natively addon. problem is, being rails newbie still, have no clue how use memcache in order speed-up time-consuming request (i know looking newrelic analysis). should use gem 'cache-money' on-top of memcache? use act_as_cached anymore?

i know pretty trivial questions. yet after searching web hours, not find decent tutorial. help/link appreciated!

you can watch caching in rails 2.1 , read memcached documentation (i suppose have read it) in heroku.

also, touch , cache quite interesting technique avoid writing sweepers in order delete cached content when need refresh cached data. using touch auto expire cached data no need write new code.

please note today, heroku memcached integration assumes using rails >= 2.3.3

the main idea add result(s) of time consuming method rails.cache (which interface through access caching mechanism). when fetch result(s) caching mechanism searches see if can find or if hasn't expired.

if finds it, returns fast because takes cache.

if doesn't find or has expired (you set when call fetch), runs actual slow method add or refresh in cache.

finally, useful read rails documentation apart whether using memcached or built in rails caching: caching rails: overview. among other things talks about:

  • page caching
  • action caching
  • fragment caching
  • sweepers
  • sql caching
  • and more ...

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -