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
the whole request in memory or just a chunk inside
webdav.NullResource.PUT().
- RAMCacheManager: Allow invalidation of a cache entry from the
Statistics view in the ZMI
Bugs fixed
- ZPublisher: changed some hardcoded 'latin1' arguments to 'iso-8859-15'
......
......@@ -346,7 +346,7 @@ class RAMCacheManager (CacheManager, SimpleItem):
'manage_stats',
'getCacheReport',
'sort_link',)),
('Change cache managers', ('manage_editProps',), ('Manager',)),
('Change cache managers', ('manage_editProps','manage_invalidate'), ('Manager',)),
)
manage_options = (
......@@ -451,6 +451,20 @@ class RAMCacheManager (CacheManager, SimpleItem):
url = url + '&sort_reverse=' + (newsr and '1' or '0')
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)
......
......@@ -2,15 +2,20 @@
<dtml-var manage_tabs>
<p class="form-help">
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
accessed entries since the last cleanup operation. The determination
is made using the <em>recent hits</em> counter.
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
accessed entries since the last cleanup operation. The determination
is made using the <em>recent hits</em> counter.
</p>
<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">
<div class="list-nav">
<dtml-var expr="sort_link('Path', 'path')">
......@@ -46,13 +51,16 @@ is made using the <em>recent hits</em> counter.
<dtml-var expr="sort_link('Entries', 'entries')">
</div>
</td>
</tr>
<dtml-in getCacheReport mapping>
<dtml-if sequence-odd>
<tr class="row-normal">
<dtml-else>
<tr class="row-hilite">
</dtml-if>
</tr>
<dtml-in getCacheReport mapping>
<dtml-if sequence-odd>
<tr class="row-normal">
<dtml-else>
<tr class="row-hilite">
</dtml-if>
<td align="left" valign="top" width="16">
<input type="checkbox" name="paths:list" value="&dtml-path;" />
</td>
<td align="left" valign="top">
<div class="list-item">
<a href="&dtml-path;/ZCacheable_manage">&dtml-path;</a>
......@@ -88,8 +96,19 @@ is made using the <em>recent hits</em> counter.
&dtml-entries;
</div>
</td>
</dtml-in>
</table>
</tr>
</dtml-in>
<tr>
<td width="16"> </td>
<td colspan="7">
<input type="submit" value=" Remove " />
</td>
</tr>
</table>
</form>
<dtml-else>
<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