##// END OF EJS Templates
users: allow caching of active users count.
marcink -
r2427:742ecbd6 default
parent child Browse files
Show More
@@ -123,9 +123,13 b' class UserModel(BaseModel):'
123 return User.get_by_auth_token(auth_token, cache)
123 return User.get_by_auth_token(auth_token, cache)
124
124
125 def get_active_user_count(self, cache=False):
125 def get_active_user_count(self, cache=False):
126 return User.query().filter(
126 qry = User.query().filter(
127 User.active == True).filter(
127 User.active == true()).filter(
128 User.username != User.DEFAULT_USER).count()
128 User.username != User.DEFAULT_USER)
129 if cache:
130 qry = qry.options(
131 FromCache("sql_cache_short", "get_active_users"))
132 return qry.count()
129
133
130 def create(self, form_data, cur_user=None):
134 def create(self, form_data, cur_user=None):
131 if not cur_user:
135 if not cur_user:
General Comments 0
You need to be logged in to leave comments. Login now