This sort of information is inherently fairly transient, though, I'd say.
 Unless you're getting a huge amount of spam from a lot of different user
IDs or your cache is already running very near to capacity (in which cases
you already have bigger problems), I'd say it should work in the great
majority of cases.
If you want to get more involved, you can make a separate memcached pool
just for this task and can also start doing things like multiple counters
per-user using incr and decr so that you can get a little more sophisticated
with your algorithm.  You can, for example, make an hourly and daily counter
for a user that you increment when they post and when they reach some
threshold, you stop them from posting, make them solve a CAPTCHA, etc...

On Tue, Jul 28, 2009 at 12:45 PM, Josef Finsel <[email protected]> wrote:

> Granted, Colin, but I wouldn't want anyone coming across a simple
> implementation like this and then expand upon it without the realization
> that memcached is not a persistent data store.
>
>
> On Tue, Jul 28, 2009 at 12:41 PM, Colin Pitrat <[email protected]>wrote:
>
>>
>> Well, I'd say that for double-post and spam control, it's not a big
>> problem if sometime it doesn't work. I mean, with this kind of
>> algorithm he already accept one spamming message, so two is not a
>> problem.
>>
>> 2009/7/28 Josef Finsel <[email protected]>:
>> > Another question you might want to ask is how are you going to handle it
>> if
>> > the item has been evicted from the cache? Someone could be spamming you
>> and
>> > you wouldn't catch it.
>> > Granted, that would have to be a cache with a high-eviction rate but
>> it's
>> > still a possibility you might want to consider.
>> >
>> > On Tue, Jul 28, 2009 at 12:04 PM, Beyza <[email protected]> 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,
>> >
>> >
>> >
>> > --
>> > "If you see a whole thing - it seems that it's always beautiful.
>> Planets,
>> > lives... But up close a world's all dirt and rocks. And day to day,
>> life's a
>> > hard job, you get tired, you lose the pattern."
>> > Ursula K. Le Guin
>> >
>> > What's different about data in the cloud? http://www.azuredba.com
>> >
>> > http://www.finsel.com/words,-words,-words.aspx (My blog) -
>> > http://www.finsel.com/photo-gallery.aspx (My Photogallery)
>> >  -http://www.reluctantdba.com/dbas-and-programmers/blog.aspx (My
>> > Professional Blog)
>> >
>>
>
>
>
> --
> "If you see a whole thing - it seems that it's always beautiful. Planets,
> lives... But up close a world's all dirt and rocks. And day to day, life's a
> hard job, you get tired, you lose the pattern."
> Ursula K. Le Guin
>
> What's different about data in the cloud? http://www.azuredba.com
>
> http://www.finsel.com/words,-words,-words.aspx (My blog) -
> http://www.finsel.com/photo-gallery.aspx (My Photogallery)  -
> http://www.reluctantdba.com/dbas-and-programmers/blog.aspx (My
> Professional Blog)
>



-- 
awl

Reply via email to