create a method that only one user can access in the same time

2009-09-29 Thread gustavo Cardoso
Hello Folks, I need to implement a Counter. One variable to store the number of users in my site. This variable can't be access in the same time for more than one user. How I do this in django. How I create a method that only one user can access in the same time? Is there some API to lock and rele

Re: create a method that only one user can access in the same time

2009-09-30 Thread gustavo Cardoso
them at cache as keys. > Or implement counter as cache.incr('users_online') > > > On Wed, Sep 30, 2009 at 3:52 AM, Nan wrote: > >> >> Any particular reason you can't just use User.objects.count() ? >> >> On Sep 29, 7:16 pm, gustavo Cardoso wr

Re: create a method that only one user can access in the same time

2009-09-30 Thread gustavo Cardoso
d > rows, such as: > > UPDATE table SET flag = 1 WHERE flag = 0; > > Then check if the operation succeeded. > > Cheers, > Dan > > On Sep 30, 11:38 am, gustavo Cardoso wrote: > > Acctually, > > > > I need to do a SELECT in a table. In this table has a flag