Mercurial > kallithea
comparison rhodecode/model/meta.py @ 609:c1c1cf772337
moved out sqlalchemy cache from meta to the config files.
added caching query for permissions.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 12 Oct 2010 16:39:53 +0200 |
parents | 342f8434ed14 |
children | 79457e03ef68 |
comparison
equal
deleted
inserted
replaced
608:101e07f82f22 | 609:c1c1cf772337 |
---|---|
26 #Base2 = declarative_base() | 26 #Base2 = declarative_base() |
27 | 27 |
28 #=============================================================================== | 28 #=============================================================================== |
29 # CACHE OPTIONS | 29 # CACHE OPTIONS |
30 #=============================================================================== | 30 #=============================================================================== |
31 cache_base = jn(dn(dn(dn(abspath(__file__)))), 'data') | 31 #Configured globally in .ini files |
32 cache_dir = jn(cache_base, 'cache') | |
33 | |
34 if not os.path.isdir(cache_base): | |
35 os.mkdir(cache_base) | |
36 | |
37 if not os.path.isdir(cache_dir): | |
38 os.mkdir(cache_dir) | |
39 # set start_time to current time | |
40 # to re-cache everything | |
41 # upon application startup | |
42 start_time = time.time() | |
43 # configure the "sqlalchemy" cache region. | |
44 cache_manager.regions['sql_cache_short'] = { | |
45 'type':'memory', | |
46 'data_dir':cache_dir, | |
47 'expire':10, | |
48 'start_time':start_time | |
49 } | |
50 cache_manager.regions['sql_cache_med'] = { | |
51 'type':'memory', | |
52 'data_dir':cache_dir, | |
53 'expire':360, | |
54 'start_time':start_time | |
55 } | |
56 cache_manager.regions['sql_cache_long'] = { | |
57 'type':'file', | |
58 'data_dir':cache_dir, | |
59 'expire':3600, | |
60 'start_time':start_time | |
61 } | |
62 #to use cache use this in query | 32 #to use cache use this in query |
63 #.options(FromCache("sqlalchemy_cache_type", "cachekey")) | 33 #.options(FromCache("sqlalchemy_cache_type", "cachekey")) |