comparison rhodecode/model/user.py @ 692:cb0d9ce6ac5c beta

#50 on point cache invalidation changes. Created cacheInvalidation table cleaned up sa sessions from models, since it wasn't really needed.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 15 Nov 2010 02:26:19 +0100
parents ecc566f8b69f
children 9e9f1b919c0c
comparison
equal deleted inserted replaced
691:7486da5f0628 692:cb0d9ce6ac5c
34 34
35 class DefaultUserException(Exception):pass 35 class DefaultUserException(Exception):pass
36 36
37 class UserModel(object): 37 class UserModel(object):
38 38
39 def __init__(self, sa=None): 39 def __init__(self):
40 if not sa: 40 self.sa = Session()
41 self.sa = Session()
42 else:
43 self.sa = sa
44 41
45 def get(self, user_id, cache=False): 42 def get(self, user_id, cache=False):
46 user = self.sa.query(User) 43 user = self.sa.query(User)
47 if cache: 44 if cache:
48 user = user.options(FromCache("sql_cache_short", 45 user = user.options(FromCache("sql_cache_short",