New commit. Instance caching

As many of you may have noticed, we hit the database rather a lot when
we’re rendering pages. Which is bad, especially when queries are
repeated.

So, I’ve added cached_model to our vendor directory and made a few
classes inherit from it. Making Blog inherit from CachedModel managed
to reduce the number of queries for a 3 article test blog’s front page
from 35 to 28 queries. Which can’t be bad. TextFilter and User are
also cached, but the performance improvement isn’t quite so good.

Out of the box, we use an in process memory cache, but it shouldn’t be
remotely hard to switch it over to use a shared memcached cache if you
can run it on your server.

Enjoy.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs