ojengwa / django-simple-captcha

Automatically exported from code.google.com/p/django-simple-captcha
MIT License
1 stars 0 forks source link

Use memcached or Redis instead of DB #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I suggest to have opportunity use memcached or Redis instead of DB. Add a new 
settings CAPTCHA_BACKEND to point backend. By default it is DB as now.

Original issue reported on code.google.com by a.vostrjakov on 27 Mar 2011 at 4:30

GoogleCodeExporter commented 9 years ago
Good idea, but I think we should rely on Django's cache backend, which supports 
both memcached and Redis, instead of doing an ad-hoc backend mechanism, what do 
you think?

Patches more than welcome.

Original comment by mbonetti on 27 Mar 2011 at 7:56

GoogleCodeExporter commented 9 years ago
Yes. I think to use Djando's cache backend will be perfect.

Original comment by a.vostrjakov on 28 Mar 2011 at 6:00

GoogleCodeExporter commented 9 years ago
Attaching a heavy patch to implement two backends: DB (like it works now) and 
Django cache. This patch also included my previous patch from 
http://code.google.com/p/django-simple-captcha/issues/detail?id=46

All backends functionality is in backends folder. Only small comment: because 
memcached and others has 'expired' functionality included I don't implement it 
in my cache backend.

Original comment by a.vostrjakov on 28 Mar 2011 at 12:20

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for this patch, it looks very promising. I have three test cases 
failing when using the cache backend: I'll take a look and see if I can fix 
them.

Also, ideally, it'd be great if we could avoid creating database tables when 
using the cache backend, but I understand this would be very tricky, what do 
you think?

Original comment by mbonetti on 28 Mar 2011 at 12:58

GoogleCodeExporter commented 9 years ago
Really I don't check tests :) Only check cache backend on my blog. 

About avoiding to create database tables: I think it is enough to say about it 
in installation description. if user included 'captcha' in INCLUDED_APPS I 
think it is really tricky to forbidden creation of tables when './manage.py 
syncdb' is executed.

P.S. Of cource, I'm really interesting to include my patches in source code :) 
So, If I can help someway. I'm ready.

Original comment by a.vostrjakov on 28 Mar 2011 at 1:14

GoogleCodeExporter commented 9 years ago
I fixed tests. Really was one bug. Now all tests is passed. But I switching off 
the test for expired field of cache-backend because it's integrated 
functionality of memcached and other caches.

I hope, now patch can be included :)

Original comment by a.vostrjakov on 29 Mar 2011 at 9:28

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks. I'm a bit busy at the moment, but will give your patch another run in a 
few hours

Original comment by mbonetti on 29 Mar 2011 at 9:37

GoogleCodeExporter commented 9 years ago
Hi!

Just remind you :) May be my patch above will be included in the project.

Original comment by a.vostrjakov on 4 Oct 2011 at 7:47