You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Simone Caruso <in...@simonecaruso.com> on 2011/03/01 16:36:46 UTC

Re: Help with apr mutex

On 28/02/2011 22:48, Ben Noordhuis wrote:
> On Mon, Feb 28, 2011 at 18:26, Simone Caruso<in...@simonecaruso.com>  wrote:
>> I wrote a simple cache inside my module with apr_shm and apr_rmm
>
> Simone, have a look at ap_socache.h and ap_slotmem.h, they're two
> simple cache facilities that were added in 2.3.0. Might save you some
> work. :)

I read trunk/modules/cache/mod_socache_shmcb.c too, looks very interesting!
Surely I will rewrite my module for 2.3 using socache,
thank you Ben.

-- 
Simone Caruso
p.iva: 03045250838

Re: Help with apr mutex

Posted by Ben Noordhuis <in...@bnoordhuis.nl>.
On Tue, Mar 1, 2011 at 17:32, Joshua Marantz <jm...@google.com> wrote:
> Is there any design doc or examples on how these can be used to, say, construct
> a server-wide cache that can be accessed from any of the child processes in
> (say) prefork mode?

I don't know of any design documents or tutorials but as to examples:

* slotmem is for fixed size caches, it's used by mod_proxy_balancer.c
to store state about its backends.

* socache is for dynamic caches, mod_ssl and mod_authn_socache.c
respectively cache SSL sessions and user credentials with it.

mod_authn_socache.c is a good starting point, it's less than 500 lines of code.

Re: Help with apr mutex

Posted by Joshua Marantz <jm...@google.com>.
For convenience, you can look at these intriguing new facilities in the SVN
repo directly without downloading the tarball:

<http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_socache.h?view=log>
http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_socache.h?view=markup
<http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_socache.h?view=markup>
http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_slotmem.h?view=markup
<http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_slotmem.h?view=markup>
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_socache_shmcb.c?view=markup

<http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_socache_shmcb.c?view=markup>Is
there any design doc or examples on how these can be used to, say, construct
a server-wide cache that can be accessed from any of the child processes in
(say) prefork mode?

Thanks!
-Josh

On Tue, Mar 1, 2011 at 10:36 AM, Simone Caruso <in...@simonecaruso.com>wrote:

> On 28/02/2011 22:48, Ben Noordhuis wrote:
>
>> On Mon, Feb 28, 2011 at 18:26, Simone Caruso<in...@simonecaruso.com>
>>  wrote:
>>
>>> I wrote a simple cache inside my module with apr_shm and apr_rmm
>>>
>>
>> Simone, have a look at ap_socache.h and ap_slotmem.h, they're two
>> simple cache facilities that were added in 2.3.0. Might save you some
>> work. :)
>>
>
> I read trunk/modules/cache/mod_socache_shmcb.c too, looks very interesting!
> Surely I will rewrite my module for 2.3 using socache,
> thank you Ben.
>
> --
> Simone Caruso
> p.iva: 03045250838
>