The components:
mod_http_cache: what mod_cache is currently
mod_cache: a generic caching module - provides glue between providers
and other modules. Think mod_dbd...
cache providers: disk, mem, memcache, mysql, etc.
An example mod_http_cache:
-generate cache key
-ask mod_cache for object with key
-mod_cache checks provider(s) and returns object on "hit"
-object may contain vary info, regenerate key and ask mod_cache with new
key (this would be equivalent to header)
-ask mod_cache for the body
-serve data to client
This would remove all the HTTP specific stuff from the cache providers
and Vary could be handled in a central location (mod_http_cache). And
it *should* be fairly trivial to write and stack cache providers.
Some functions a provider should provide:
init(args...) - initialize an instance :)
open(instance, key) - open a cache object
read_buffer(object, buffer, copy) - read entire object into buffer.
buffer may be read only (ie, it may be mmapped or part of sql statement)
or make it a copy.
read_bb(object, brigade, copy) - read object into a brigade. copy if
flag is set
store_bb(object, brigade) - store a bucket brigade
store_buffer(object, buffer) - store a blob of data
close(object)
Thoughts? I'm sure we may need more/better cache provider functions.
--
Brian Akins
Lead Systems Engineer
CNN Internet Technologies