The CachePool product:

# this readme written at 0.2.4 state

this piece of software is getting stable... I hope :)

HOW IT WORKS:

Well, basically you create one instance somewhere, and name it whatever you want. As an example, let's say I named it 'index_html' in the root directory.
Now I edit it's properties so that DocToParse points to 'index_orig', the TTL (time to live, in secs) to 60 and the CacheSlots to, say, 5. Now, after I 'Do It', I'll create a DTML Document called 'index_orig'. I have put in there whatever I wanted, do the same.

NOW... We're ready to roll (cache).

If you take a look at the 'view cache' tab, you'll notice that there's none
of five slots used.

The properties for each cache slot are:
  - URL1
  - QueryString
  - hpcc (Hits per cache cycle, the number of times a slot has been called
     since the last expire)
  - CacheDate - when cache was last refreshed... in secs till the epoch
  - Flush - to del specific cache slots

As you view the index_html, the cache starts building. And the rules are...

 - Cache's identity are the URL called (URL1) and the Query passed
(QueryString).
 - If there's a request for a page the CachePool does the following:
  1 - try to find out if a slot with the same URL1 and QS already exists...
      see below if one is found
  2 - none found on 1? check to see if there's a free slot. If so create a new one
  3 - no free slot? check to see if there are expired caches. deletes the one
      with the lowest hpcc. proceeds as no. 2
  4 - returns the page, but doesn't cache, if none of the above succeeds

  A new cache slot has CacheDate reset to 0.
  If CacheDate + TTL is smaller than current time in secs till the epoch,
then the slot has expired. Set Cached to None.
  If Cached is not None than we have a Slot with unexpired content. Return
it and add one to the hpcc.
  If Cached is None, slot's content has expired or slot is new. So, call the
page in the form URL1/DocToParse?QueryString and Cache the result. Set
CacheDate to now() and set Cached to 1. Also reset hpcc to 0.

The basic filosofy here is that several dinamic pages based on a common index_html are diferent from each other through aquisition. So if you have:
  Index_html
    |-- Folder 1
    |-- Folder 2
    | |-- Folder 2.1
    | |-- Folder 2.2
    |-- Folder 3

and index_html depends on some objs or properties in the folders, calling 'your.site/' and 'your.site/Folder2/Folder2.1' render differently, even though they call the same 'index_html'. The magic stuff happens if you rename index_html to, say, index_orig and you create a CachePool called index_html, pointing to index_orig. Now, if you call 'your.site/' CachePool will cache the rendered version in a slot with URL1 pointing to 'your.site/. Calling 'your.site/Folder2/Folder2.1' will cache the rendered version in a slot with URL1 pointing to 'your.site/Folder2/Folder2.1'. Now, when called again, both URLs will return the rendered version, as long as they don't expire. This gives zope the ability of answering more requests/sec in highly dinamic sites. As explained earlier, it also takes note of the QueryString, so form results are also cached, based on the form vars. 

----

A CHANGE WORTH OF NOTICE!!!!
From now (0.2.4) on only folders with a 'toCache'
boolean property set to true will be 
cached... this will allow you to create one index_html Cache but prevent from c
aching everything, and so not using CacheSlots available for more important thi
ngs...
So, if one folder /cache has a toCache true prop, calling /cache or /cache/*any
thing* will cache, but if a folder 'dontcache'(or subfolder on cache) has a toCache prop s
et to false, calling /cache/dontcache will not cache.


----

Todos & Gotchas:

 DONT set DocToParse pointing to the CachePool. It will loop forever (easy
to fix, so I haven't spent time on it ;) )
 Set up a mechanism to be able to avoid caching of certain folders. For realtime forms used in long TTL caches

----

I obviously won't take any responsability whatsoever for any damage or loss
produced by the use of this product. Nonetheless, I have tryed to make it as
stable as possible. If you do use it and want to ask for some feature,
report a bug or just send me a big amount of money so that I can retire and
stop working in these dumb products, do it through the e-mail
neli@zopers.org. Of course, for sending money, ask for my account
number ;)


-- neli
