aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2007-11-10 13:04:51 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2007-11-10 13:04:51 +0000
commite1f5188dd4d7457d9cf3c1e27868e977c4d293d8 (patch)
treed745bae3b4a974bb609fb27822505eb8784cfcf2 /web
parentFactor out some duplicate MC code. (diff)
downloadpackages-e1f5188dd4d7457d9cf3c1e27868e977c4d293d8.tar.gz
packages-e1f5188dd4d7457d9cf3c1e27868e977c4d293d8.tar.bz2
packages-e1f5188dd4d7457d9cf3c1e27868e977c4d293d8.zip
Wrapper moved, and remember the timeout now.
Diffstat (limited to 'web')
-rw-r--r--web/controller.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/web/controller.py b/web/controller.py
index 5861530..f7f4ef7 100644
--- a/web/controller.py
+++ b/web/controller.py
@@ -25,35 +25,27 @@ class Root(object):
def __init__(self, db):
self.database = db
- def _mc_wrap(self, key, func, **kwopts):
- obj = None
- if self.database.mc:
- obj = self.database.mc.get(key)
- if not obj:
- obj = func()
- if self.database.mc and obj:
- self.database.mc.set(key, obj, **kwopts)
- return obj
@property
def cache_latest(self):
def f():
entry_filter = filters.EntryFilters(self.database)
return entry_filter.unfiltered()
- return self._mc_wrap('cache_latest', f)
+ return self.database._mc_wrap('cache_latest', f, time=300)
@property
def cache_newpkgs(self):
def f():
entry_filter = filters.EntryFilters(self.database)
return entry_filter.newpkgs_filter()
- return self._mc_wrap('cache_newpkgs', f)
+ return self.database._mc_wrap('cache_newpkgs', f, time=300)
+
@property
def cache_verbumps(self):
def f():
entry_filter = filters.EntryFilters(self.database)
return entry_filter.verbumps_filter()
- return self._mc_wrap('cache_verbumps', f)
+ return self.database._mc_wrap('cache_verbumps', f, time=300)
@cherrypy.expose
@template.expire_on_30_min()