load values into a memcache

son at raider.co.nz son at raider.co.nz
Wed Mar 7 22:19:53 UTC 2007

> I would suggest you hit the database and fill the cache only as requests
> come in.  If you have some notion of high-trafficked keys, you could
> perhaps warm the cache appropriately.
> If a given key gets a ton of hits, it will quickly be in the cache.  If
> a given key gets no hits, well, why would you want it in the cache?
> Enjoy!

Thank you for your suggestion. My problem is my site may have ton of hits
for a second (eg. 2000 hits/second).

My application is redirect url. If  a user enter a url, he will be
redirect to another one. So it needs fast. I store keys is "from_url" and
value is "to_url"

If I call database for a request (of course, this request is not in
memcache yet), I may miss some hits as a query need a time to get back the

ONly when I  need to add a redirect (from_url and to_url), I will update
this memcache

More information about the memcached mailing list