[pypy-svn] r40537 - pypy/dist/pypy/tool/build/web
guido at codespeak.net
guido at codespeak.net
Thu Mar 15 15:53:58 CET 2007
Author: guido
Date: Thu Mar 15 15:53:56 2007
New Revision: 40537
Modified:
pypy/dist/pypy/tool/build/web/app.py
Log:
Cleaning up old cached items.
Modified: pypy/dist/pypy/tool/build/web/app.py
==============================================================================
--- pypy/dist/pypy/tool/build/web/app.py (original)
+++ pypy/dist/pypy/tool/build/web/app.py Thu Mar 15 15:53:56 2007
@@ -121,6 +121,15 @@
self._shared['initialized'] = False
self.gateway = None
+ def _cleanup_cache(self):
+ mintime = time.time() - self.MAX_CACHE_TIME
+ topop = []
+ for key, (ctime, data) in self._shared['result_cache'].items():
+ if ctime < mintime:
+ topop.append(key)
+ for key in topop:
+ del self._shared['result_cache'][key]
+
remote_code = """
import sys
sys.path += %r
@@ -147,6 +156,8 @@
"""
self._shared['lock'].acquire()
try:
+ # XXX should we perhaps do this only once ever X times?
+ self._cleanup_cache()
try:
ctime, value = self._shared['result_cache'][(methodname, args)]
except KeyError:
More information about the Pypy-commit
mailing list