Commit d49c0671 authored by Jens Vagelpohl's avatar Jens Vagelpohl

- RAMCacheManager: Allow invalidation of a cache entry from the

  Statistics view in the ZMI
parent d28d8575
...@@ -32,6 +32,9 @@ Zope Changes ...@@ -32,6 +32,9 @@ Zope Changes
the whole request in memory or just a chunk inside the whole request in memory or just a chunk inside
webdav.NullResource.PUT(). webdav.NullResource.PUT().
- RAMCacheManager: Allow invalidation of a cache entry from the
Statistics view in the ZMI
Bugs fixed Bugs fixed
- ZPublisher: changed some hardcoded 'latin1' arguments to 'iso-8859-15' - ZPublisher: changed some hardcoded 'latin1' arguments to 'iso-8859-15'
......
...@@ -346,7 +346,7 @@ class RAMCacheManager (CacheManager, SimpleItem): ...@@ -346,7 +346,7 @@ class RAMCacheManager (CacheManager, SimpleItem):
'manage_stats', 'manage_stats',
'getCacheReport', 'getCacheReport',
'sort_link',)), 'sort_link',)),
('Change cache managers', ('manage_editProps',), ('Manager',)), ('Change cache managers', ('manage_editProps','manage_invalidate'), ('Manager',)),
) )
manage_options = ( manage_options = (
...@@ -451,6 +451,20 @@ class RAMCacheManager (CacheManager, SimpleItem): ...@@ -451,6 +451,20 @@ class RAMCacheManager (CacheManager, SimpleItem):
url = url + '&sort_reverse=' + (newsr and '1' or '0') url = url + '&sort_reverse=' + (newsr and '1' or '0')
return '<a href="%s">%s</a>' % (escape(url, 1), escape(name)) return '<a href="%s">%s</a>' % (escape(url, 1), escape(name))
def manage_invalidate(self, paths, REQUEST=None):
""" ZMI helper to invalidate an entry """
for path in paths:
try:
ob = self.unrestrictedTraverse(path)
except (AttributeError, KeyError):
pass
ob.ZCacheable_invalidate()
if REQUEST is not None:
msg = 'Cache entries invalidated'
return self.manage_stats(manage_tabs_message=msg)
Globals.default__class_init__(RAMCacheManager) Globals.default__class_init__(RAMCacheManager)
......
...@@ -2,15 +2,20 @@ ...@@ -2,15 +2,20 @@
<dtml-var manage_tabs> <dtml-var manage_tabs>
<p class="form-help"> <p class="form-help">
Memory usage is approximate. It is based on the pickled value of the Memory usage is approximate. It is based on the pickled value of the
cached data. The cache is cleaned up by removing the least frequently cached data. The cache is cleaned up by removing the least frequently
accessed entries since the last cleanup operation. The determination accessed entries since the last cleanup operation. The determination
is made using the <em>recent hits</em> counter. is made using the <em>recent hits</em> counter.
</p> </p>
<dtml-if getCacheReport> <dtml-if getCacheReport>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr class="list-header"> <form method="post" action="manage_invalidate">
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr class="list-header">
<td align="left" valign="top" class="list-nav" width="16">
</td>
<td align="left" valign="top"> <td align="left" valign="top">
<div class="list-nav"> <div class="list-nav">
<dtml-var expr="sort_link('Path', 'path')"> <dtml-var expr="sort_link('Path', 'path')">
...@@ -46,13 +51,16 @@ is made using the <em>recent hits</em> counter. ...@@ -46,13 +51,16 @@ is made using the <em>recent hits</em> counter.
<dtml-var expr="sort_link('Entries', 'entries')"> <dtml-var expr="sort_link('Entries', 'entries')">
</div> </div>
</td> </td>
</tr> </tr>
<dtml-in getCacheReport mapping> <dtml-in getCacheReport mapping>
<dtml-if sequence-odd> <dtml-if sequence-odd>
<tr class="row-normal"> <tr class="row-normal">
<dtml-else> <dtml-else>
<tr class="row-hilite"> <tr class="row-hilite">
</dtml-if> </dtml-if>
<td align="left" valign="top" width="16">
<input type="checkbox" name="paths:list" value="&dtml-path;" />
</td>
<td align="left" valign="top"> <td align="left" valign="top">
<div class="list-item"> <div class="list-item">
<a href="&dtml-path;/ZCacheable_manage">&dtml-path;</a> <a href="&dtml-path;/ZCacheable_manage">&dtml-path;</a>
...@@ -88,8 +96,19 @@ is made using the <em>recent hits</em> counter. ...@@ -88,8 +96,19 @@ is made using the <em>recent hits</em> counter.
&dtml-entries; &dtml-entries;
</div> </div>
</td> </td>
</dtml-in> </tr>
</table> </dtml-in>
<tr>
<td width="16"> </td>
<td colspan="7">
<input type="submit" value=" Remove " />
</td>
</tr>
</table>
</form>
<dtml-else> <dtml-else>
<p class="form-text"> <p class="form-text">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment