You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Sterling Hughes <st...@designmultimedia.com> on 2001/08/18 07:40:07 UTC
Caching handles?
Hi,
I'm developing a module (httpd2.0) and I've come across a situation
where it would be great if I could "cache" an operation, by saving a
variable in memory, and keep it there throughout requests, ie:
/* top level */
static int module_id;
/* in init func */
module_id = cache_init();
/* In some other function */
cache_storage *p;
some_type_t *what_we_want; /* gotta love that variable name :) */
if (cache_get(module_id, &p) == SUCCESS) {
what_we_want = p->data;
}
else {
what_we_want = alloc_new();
cache_store(module_id, &what_we_want);
}
/* Manipulate what_we_want */
Is something like this available? (I don't need a full explanation,
although I wouldn't mind one, just a pointer to the source I should
be looking at...)
Thanks,
Sterling
Re: Caching handles?
Posted by Ryan Bloom <rb...@covalent.net>.
The closest thing to what you want to do is probably mod_file_cache.
Ryan
On Friday 17 August 2001 22:40, Sterling Hughes wrote:
> Hi,
>
> I'm developing a module (httpd2.0) and I've come across a situation
> where it would be great if I could "cache" an operation, by saving a
> variable in memory, and keep it there throughout requests, ie:
>
> /* top level */
> static int module_id;
>
> /* in init func */
> module_id = cache_init();
>
> /* In some other function */
> cache_storage *p;
> some_type_t *what_we_want; /* gotta love that variable name :) */
>
> if (cache_get(module_id, &p) == SUCCESS) {
> what_we_want = p->data;
> }
> else {
> what_we_want = alloc_new();
> cache_store(module_id, &what_we_want);
> }
>
> /* Manipulate what_we_want */
>
> Is something like this available? (I don't need a full explanation,
> although I wouldn't mind one, just a pointer to the source I should
> be looking at...)
>
> Thanks,
> Sterling
--
______________________________________________________________
Ryan Bloom rbb@apache.org
Covalent Technologies rbb@covalent.net
--------------------------------------------------------------
Re: Caching handles?
Posted by Graham Leggett <mi...@sharp.fm>.
Sterling Hughes wrote:
> I'm developing a module (httpd2.0) and I've come across a situation
> where it would be great if I could "cache" an operation, by saving a
> variable in memory, and keep it there throughout requests, ie:
Take a look inside the code inside httpd-2.0/modules/ldap/util_ldap.c -
an operation shared memory cache is used there to cache LDAP queries -
it should give you an example to get you on the right track.
Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm "There's a moon
over Bourbon Street
tonight..."