On Tue, 02 May 2006 23:31:13 +0200
Graham Leggett <[EMAIL PROTECTED]> wrote:
> Davi Arnaut wrote:
>
> >> The way HTTP caching works is a lot more complex than in your example, you
> >> haven't taken into account conditional HTTP requests.
> >
> > I've taken into account the actual mod_disk_cache code!
>
> mod_disk_cache doesn't contain any of the conditional HTTP request code,
> which is why you're not seeing it there.
>
> Please keep in mind that the existing mod_cache framework's goal is to
> be a fully HTTP/1.1 compliant, content generator neutral, efficient,
> error free and high performance cache.
>
> Moving towards and keeping with the above goals is a far higher priority
> than simplifying the generic backend cache interface.
>
> To sum up - the cache backend must fulfill the requirements of the cache
> frontend (generic or not), which in turn must fulfill the requirements
> of the users, who are browsers, web robot code, and humans. To try and
> prioritise this the other way round is putting the cart before the horse.
Graham, what I want is to be able to write a mod_cache backend _without_
having to worry about HTTP. _NOT_ to rewrite mod_disk/proxy/cache/whatever!
You keep talking about HTTP this, HTTP that, I wont change the way it currently
works. I just want to place a glue beteween the storage and the HTTP part.
I could even wrap around your code:
typedef struct
apr_status_t (*fetch) (cache_handle_t *h, apr_bucket_brigade *bb);
apr_status_t (*store) (cache_handle_t *h, apr_bucket_brigade *bb);
int (*remove) (const char *key);
} my_cache_provider;
typedef struct {
const char *key_headers;
const char *key_body;
} my_cache_object;
create_entity:
my_cache_object *obj;
obj->key_headers = hash_headers(request, whatever);
obj->key_body = hash_body(request, whatever);
open_entity:
my_cache_object *obj;
my_provider->fetch(h, obj->key_headers, header_brigade);
// if necessary, update obj->key_headers/body (vary..)
remove_url:
my_provider->remove(obj->key_header);
my_provider->remove(obj->key_body);
remove_entity:
nop
store_headers:
my_cache_object *obj;
// if necessary, update obj->key_headers (vary..)
my_provider->store(h, obj->key_headers, header_brigade);
store_body:
my_cache_object *obj;
my_provider->store(h, obj->key_body, body_brigade)
recall_headers:
my_cache_object *obj;
my_provider->fetch(h, obj->key_headers, header_brigade);
recall_body:
my_cache_object *obj;
my_provider->fetch(h, obj->key_body, body_brigade);
--
Davi Arnaut