[Dbix-class] REPOST: memcache / DBIx::Class

Brandon Black blblack at gmail.com
Wed May 30 00:57:30 GMT 2007


On 5/29/07, Steve Atkins <steve at blighty.com> wrote:
> When I use memcache I have the database invalidate the
> cache when the underlying data changes. That catches
> any potentially invalidating change whether it comes from
> the webapp, a backend tool, the command line, a trigger
> or anything else.
>
> Works very nicely for simple selects, but gets a bit hairier
> the more complex the queries get.
>
> (pgmemcache does that nicely for postgresql, I'd guess that
> implementing it for any other reasonably built database wouldn't
> be hard.)
>
> Even if there were to be full support in DBIC for invalidating
> the cache it would be really nice to be able to disable it completely
> when the database itself is setup to manage invalidation.


For those that haven't seen it and can't be bothered to read up on it,
basically it involves putting trigger code on your tables at the
database level which call the memcache API and invalidate memcache
entries on update/delete.  For Pg this is especially easy as triggers
can be written in just about anything (Perl, Python, C, etc, etc...).

pgmemcache is a really nifty thing, and in the case of caching
individual rows (objects) on PK, we can certainly work with it, we
just need to keep it in mind like you said.

It would be cool if someone would implement this for MySQL too.

-- Brandon



More information about the Dbix-class mailing list