deleting the entire cache

Tim Yardley
Wed, 31 Dec 2003 21:26:46 -0600

Out of curiousity, what are the guidelines that LJ is using in determining
what to cache and how to cache it?

Are you caching structures? Arrays of result rows from the DB?


-----Original Message-----
[] On Behalf Of Brad Fitzpatrick
Sent: Wednesday, December 31, 2003 3:04 PM
Subject: RE: deleting the entire cache

We won't add that.  It doesn't work in a distributed way.

Instead, make your "uid:43:*" keys be an array:

        uid:43:foo = [ current_time, actual_value ]

Then if you want to flush you do:

        uid:43:flush_time = current_time

Then your app does:

        memcache::get_multi("uid:43:foo", "uid:43:flush_time");
        // and compares foo->[0] and flush_time, killing uid:43:foo if
        // it's old than the flush time

Or something like that.

On Wed, 31 Dec 2003, Justin wrote:

> I don't know C well enough to be able to tell if this is do-able without
> slowing down memcached.
> Would it be possible to have something like a flush_match command?
> Say I have a bunch of keys like "uid:43:userinfo", "uid:43:profile1", etc
> etc... It'd be super-cool if I could do something like "flush_match
> and memcached nukes all keys that start with uid:49.  I'm not talking
> a fullblown regex, just very simplistic front-of-string matching.
> -----Original Message-----
> From:
> [] On Behalf Of Brad Fitzpatrick
> Sent: Tuesday, December 30, 2003 2:36 PM
> To:
> Subject: Re: deleting the entire cache
> It does.
> I might as well make a new release (even though it'll be boring and
> small).  One sec.
> On Tue, 30 Dec 2003, Chris Ochs wrote:
> >
> > The intended use we have for memcached is to cut down on queries to our
> > database for user configuration information that is needed by the
> > application for every request.   When configuration variables are
> in
> > memcache I need a way to delete all old variables, but without knowing
> what
> > they are.   I just want to wipe the memory and start fresh so to speak.
> > Does the new flush command in cvs do this?  If so is there a tarball of
> the
> > current cvs version?
> >
> > Chris
> >
> >