tracking online user count under memcached

Xuefer xuefer at
Fri Jun 17 11:26:21 PDT 2005

On 6/18/05, Skylos <skylos at> wrote:
> On 6/17/05, Xuefer <xuefer at> wrote:
> > On 6/17/05, Skylos <skylos at> wrote:
> > > with incr/decr calls based on login/logout events on a key named for
> > > the particular site?  The calls are atomic, after all.
> >
> > this cannot handle session expiring
> If a session expires by some action on the web server, then you can
> use that action to generate an event to the memcached.  (like
> Session_OnEnd in ASP)
ASP do Session_OnEnd when he know the session is expiring. in another
word, he knows all session data, at least the expires time, and scan
it periodly.
but memcached don't to it

> In a system I designed and programmed, my cache is backed by a
> database out of necessity.  The session expiration time is entered in
> the database, so there's always a way for me to tell what sessions are
> active by doing a simple query.  I can then retrieve the appropriate
> keys from memcached based on that list.
> Sounds like you really want a relational database, so you can return
> sets of related records, rather than a hash indexed caching engine.
i'm currently store session in db but i'd like to use memcached.

> David

btw, you might need to "reply all" for mailinglist

More information about the memcached mailing list