Re: Patch for simple walk caching

Ted Leung <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
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.

>
> 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.

>
> Thanks for trying the patch out and for the ideas on how to improve
> it; I think optimization is all kinds of fun, so I'll play with it
> some today.

----
Ted Leung                          Blog: <http://www.sauria.com/blog>
PGP Fingerprint: 1003 7870 251F FA71 A59A  CEE3 BEBA 2B87 F5FC 4B42



-------------------------------------------------------
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.