[Zope3-checkins] SVN: Zope3/trunk/ Fixed
zope.app.cache.ram.RAMCache which ignored the cleanupInterval
Bernd Dorn
bernd.dorn at lovelysystems.com
Mon Mar 5 08:10:42 EST 2007
Log message for revision 72987:
Fixed zope.app.cache.ram.RAMCache which ignored the cleanupInterval
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/src/zope/app/cache/ram.py
U Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2007-03-05 13:07:27 UTC (rev 72986)
+++ Zope3/trunk/doc/CHANGES.txt 2007-03-05 13:10:41 UTC (rev 72987)
@@ -189,7 +189,10 @@
Bug fixes
- - zope.app.form.browser.textwidgets: The TextAreaWidget was not escaping
+ - Fixed zope.app.cache.ram.RAMCache which ignored the
+ cleanupInterval.
+
+ - zope.app.form.browser.textwidgets: The TextAreaWidget was not escaping
its content when the validation failed. This way <, > and & were put
out unquoted.
Modified: Zope3/trunk/src/zope/app/cache/ram.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/ram.py 2007-03-05 13:07:27 UTC (rev 72986)
+++ Zope3/trunk/src/zope/app/cache/ram.py 2007-03-05 13:10:41 UTC (rev 72987)
@@ -286,6 +286,7 @@
"Cleanup the data"
self.removeStaleEntries()
self.removeLeastAccessed()
+ self.lastCleanup = time()
def removeLeastAccessed(self):
""
Modified: Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py 2007-03-05 13:07:27 UTC (rev 72986)
+++ Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py 2007-03-05 13:10:41 UTC (rev 72987)
@@ -87,6 +87,17 @@
self.assertEqual(s.maxAge, 2, "maxAge not set")
self.assertEqual(s.cleanupInterval, 3, "cleanupInterval not set")
+ def test_timedCleanup(self):
+ from zope.app.cache.ram import RAMCache
+ import time
+ c = RAMCache()
+ c.update(cleanupInterval=1, maxAge=2)
+ lastCleanup = c._getStorage().lastCleanup
+ time.sleep(2)
+ c.set(42, "object", key={'foo': 'bar'})
+ # last cleanup should now be updated
+ self.failUnless(lastCleanup < c._getStorage().lastCleanup)
+
def test_cache(self):
from zope.app.cache import ram
self.assertEqual(type(ram.caches), type({}),
More information about the Zope3-Checkins
mailing list