[Dbix-class] Caching a resultset?

David Cantrell david at cantrell.org.uk
Tue Jan 15 14:15:02 GMT 2013


On Sun, Jan 13, 2013 at 11:35:06PM -0500, Jesse Sheidlower wrote:

> I have a Catalyst app that very frequently (pretty much every request)
> requires several DBIC resultsets that return a small number of values,
> that very rarely change. I'm trying to cache this, so I can update the
> cache when the values change and not have to hit my DB a half-dozen
> times on every request for data that is effectively static.

To solve this problem at the BBC in the guts of iPlayer, we used
memcache.  We *didn't* bother updating the cache if the DB contents
changed though, as we didn't mind the user's view being a few minutes
out of date.

I've spent quite a bit of time thinking about how to solve this in the
general case, and not come up with anything that works yet - not even
anything that works in theory and goes arse-over-tit in practice.

Can you at least reduce it to one query with a left right in out shake
it all about join?

-- 
David Cantrell | Minister for Arbitrary Justice

    It's my experience that neither users nor customers can articulate
    what it is they want, nor can they evaluate it when they see it
        -- Alan Cooper



More information about the DBIx-Class mailing list