ninajansen.dk

ninajansen.dk header image 1

Entries Tagged as 'rspec'

Testing caching with memcache, cache_fu and rspec

maj 21st, 2008 · Comments

I use cache_fu for caching my rails application. I use a “fat models, skinny controllers strategy”. This means that my Author model has code like this:

def cached_books
get_cache(:author_books) do
Book.find_by_author_id(self.id)
end
end

This method caches all books belonging to an author. Cache fu does not cache belongs_to or has_(one|many) relationships, and that’s why we have this method. But this also [...]

[Read more →]

Tags: Ruby on Rails · cache · memcache · rspec