Hey, You might want to consider using 'add' with a zero byte value (or just a single byte value, whatever). Then every time you just run the single add command. If it fails you're fetching too fast. If it works then the key didn't exist already.
There're a bunch of ways of doing more proper rate limiting if you ever need it - google around and check the FAQ. -Dormando On Tue, 28 Jul 2009, Beyza wrote: > > Hi, > > This is not an important question, but I wonder the answer. > > When I develop websites by using memcache, I also use it for spam > checking. > > For example; When someone post a comment, or report something, or > search something, I create a memcache object and set an expiration > time, i.e. 5 seconds. It goes something like that > > memcache_set($memcache, "comment-check-userid", '1', 0, 5); > > I check every time whether this value is set or not. If it's set, I > consider it as a spam. > > My question is that, is it expensive to create this if you compare > with other options for this purpose? I could not find any information > about this on the internet. I am just curious :) > > Thanks from now on, >