I would second Russ' memcached recommendation. We use custom authorization modules that do some obj level lookups in addition to some other ACL type stuff. We've cut down seriously on the amount of DB hits by:
1- Caching a lot of the more static type of authorization rulesets ( the ACLs ) 2- Using cache-then-db backed sessions to store certain types of credential information. Depending on your needs it could be as quick of a win as Russ' flag(s) method or you might ( as I have ) run into some migraine inducing cache invalidation strategies. Good luck either way! -j On Wed, Nov 17, 2010 at 9:59 AM, Russ B. <russell.bernha...@gmail.com>wrote: > Authorize them against the DB the first time, then attach some flag to > their session that represents "authorized" that your views check on > instead of having them work with the auth models (or however you're > doing it). If the "authorized" flag doesn't exist, redirect them to > the login page. > > You may also be interested in reading about memcached and how to > configure Django to work with it; it's cut back a lot of my own > database hits. > > Russ B. > > On Nov 16, 10:34 pm, Jani Tiainen <rede...@gmail.com> wrote: > > Hi, > > > > I've application that uses ajax and most of my views are protected by > > @login_required decorator, some of them with additional permissions. > > > > Problem is now that I get lot of hits to database to check rather static > > credential information. > > > > Is there way to cache these credentials so that I would hit database more > > infrequently? > > > > -- > > > > Jani Tiainen > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.