load values into a memcache

Randy Wigginton krw at nobugz.com
Thu Mar 8 14:52:53 UTC 2007


If you know all of the pairs before hand, just put them into memcache  
before putting your server into production.  If not, you need a  
"default" to_url at a minimum, so that you can redirect to that while  
you fetch from the DB and populate the memcache instance.

Populating it should be easy and straightforward.

On Mar 7, 2007, at 2:19 PM, son at raider.co.nz wrote:

>
>> 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
> result.
>
> 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