Re: Patch for simple walk caching
Bill Mill <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 9 Dec 2004 02:04:02 -0800, Ted Leung <[email protected]> wrote: > > On Dec 7, 2004, at 7:56 AM, Bill Mill wrote: > > > What if there was a function invalidate_cache(path) - and when a > > plugin received an update to a page, it would invalidate the cache for > > that path. From the client (plugin) side, ideally it would look > > something like: > > > > if config['cache_dir']: #if using cache > > invalidate(path_to_changed_file) #invalidate the path > > I think this is the kind of client API I was looking for > > > > > the problem is from the cache server side - how does it figure out > > which caches include that file? Does it open and search through all of > > them? Can you launch a background thread from a CGI script? If you > > can, then the user shouldn't experience too much delay, and his > > changes should be implemented soon but not instantly. If not, he's > > going to have to wait a while before his change is implemented. > > Once you have a cache, then you have to manage it, which is why I didn't > try to get all fancy. It's especially tough in pyblosxom because there > are so many legal paths. > Well, that's all the fun for me. I'll see what I can hack up. > > > > > > The other thought I have would be to maintain a listing of what files > > are in what caches. However, it's obviously really crucial to keep > > overhead on the cache as low as possible, or the fix becomes the > > problem. > > > > Also, as Wari said, permalinks don't even benefit from caching much. > > The question is how to determine that something is a permalink - I > > think I'll just set the cache up to ignore filelists with only one > > entry. > > I'm not all the concerned about permalinks, although I suppose I > might be if my readership grew a lot (unlikely). If my front page and > RSS feed (which I haven't timed at all) go faster, then I'll be happy. > It's really simple to modify the caching to work only for those two files. Put this in your config.py: py['cache_only'] = ['pyblosxom.cgi', 'root', 'index.rss'] # '' gets changed to root and then change if config.get('cache_dir'): to p = http.get('PATH_INFO', '').lstrip('/') or 'root' if config.get('cache_dir') and p in config.get('cache_only'): Peace Bill Mill bill.mill at gmail.com ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/