memcached: which is faster, doing an add (and checking result), or doing a get (and set when returning false)

后端 未结 2 1905
夕颜
夕颜 2021-01-12 19:18

The title of this question isn\'t so clear, but the code and question is straightforward.

Let\'s say I want to show my users an ad once per day. To accomplish this,

2条回答
  •  清酒与你
    2021-01-12 19:55

    If you know the key exists, it would probably be faster to do an increment operation and look at the results. This is similar to the rate limiting and throttling problems that people encounter; you could probably craft a good Google search knowing that.

提交回复
热议问题