ttencate/blimp — Issue #14: Add really awesome Magic Output Caching
Author: ttencate
Created: 2012-01-14 23:57:42+00:00
State: open

Turns out, we already have most of the pieces for this, but we need the Redis-based filesystem first.

Rough outline of the plan:

* A Site, instead of handing its own Source to a Handler, hands it a special Source wrapper.
* This wrapper tracks all accesses and stores them in Redis. The key is "i:/path/to/file/or/dir" (i for invalidate), the value is the set of URLs whose Handlers accessed this particular file/directory.
* When the Handler is done, its output is also stuffed into Redis, keyed as "u:/request/path" (u for URL). This might mean that we have to invoke the Handler from Site, not from WebServer, but that might make more sense anyway.
* When any change is detected on the filesystem, not only are the new file's contents written into Redis, but we also look up the set "i:/path/to/file/or/dir", iterate through the set, and delete each dependent "u:/request/path" URL from the cache.