betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

19 December 2005

Resetting RAM Cache Manager on COREBlog entry edits

Just a little bit more friendly tweaking

As seen in previous posts (Experiments with RAM cache and RAMcache for COREBlog update), I'm using a RAMCacheManager in Zope to speed up the weblog loading and to ease load on the server. So far the downside has been that after editing a post I had to manually reset the cache. This would even be the case when I would preview a post multiple times before adding it. Not the best solution and definitely an itch that needed scratching...

The solution is to invalidate the RAM cache on edits. That is done in the manage_editEntry method of the Entry class. I'm cacheing the entry_body dtml method, so I have to reset the cache for that one. On the positive side this works and is much easier for me, editing existing posts and previewing behaves now just as if my COREBlog wasn't cached. The downside is that there could be unneeded cache resets, as I always reset. Also the resetting happens for all posts, not just for this entry. Anyway, here is the patch:

--- Entry.py_orig       Mon Dec 19 14:18:54 2005
+++    Mon Dec 19 14:39:18 2005
@@ -267,6 +267,9 @@
         if not title:
             kw['worning_message'] = "Title is required."

+       # invalidate the cache if this entry is cached:
+       self.entry_body.ZCacheable_invalidate()
         if REQUEST:
             if sendnow and addedtbs:
                 #send trackback

Posted by betabug at 14:58 | Comments (0) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< Plastiline Fun | Main | Christmas Light Impressions >>
There are no comments.
You can trackback to:
There are no trackbacks.