Shared Object Cache in Apache HTTP Server
Shared Object Cache in Apache HTTP Server
The Shared Object Cache provides a means to share simple data across all a server's workers, regardless of thread and process models. It is used where the advantages of sharing data across processes outweigh the performance overhead of inter-process communication.
The shared object cache as such is an abstraction. Four different modules implement it. To use the cache, one or more of these modules must be present, and configured.
The only configuration required is to select which cache provider to use. This is the responsibility of modules using the cache, and they enable selection using directives such as CacheSocache
Currently available providers are:
) - This makes use of a DBM hash file. The choice of underlying DBM used may be configurable if the installed APR version supports multiple DBM implementations. - "dc" ( modsocachedc
) - This makes use of the memcached high-performance, distributed memory object caching system. - "shmcb" ( modsocacheshmcb
) - This makes use of a high-performance cyclic buffer inside a shared memory segment.
The API provides the following functions:
- const char create(apsocacheinstancet instance, const char arg, aprpoolt tmp, aprpoolt p); - Create a session cache based on the given configuration string. The instance pointer returned in the instance paramater will be passed as the first argument to subsequent invocations. - aprstatust init(apsocacheinstancet instance, const char cname, const struct apsocachehints hints, serverrec s, aprpoolt pool) - Initialize the cache. The cname must be of maximum length 16 characters, and uniquely identifies the consumer of the cache within the server; using the module name is recommended, e.g. "modssl-sess". This string may be used within a filesystem path so use of only alphanumeric [a-z0-9-] characters is recommended. If hints is non-NULL, it gives a set of hints for the provider. Return APR error code. - void destroy(apsocacheinstancet instance, serverrec s) - Destroy a given cache instance object. - aprstatust store(apsocacheinstancet instance, serverrec s, const unsigned char id, unsigned int idlen, aprtimet expiry, unsigned char data, unsigned int datalen, aprpoolt pool) - Store an object in a cache instance. - aprstatust retrieve(apsocacheinstancet instance, serverrec s, const unsigned char id, unsigned int idlen, unsigned char data, unsigned int datalen, aprpoolt pool) - Retrieve a cached object. - aprstatust remove(apsocacheinstancet *instance, serverrec s, const unsigned char id, unsigned int idlen, aprpoolt pool) - Remove an object from the cache. - void status(apsocacheinstancet instance, requestrec r, int flags) - Dump the status of a cache instance for modstatus. - aprstatust iterate(apsocacheinstancet instance, serverrec s, void userctx, apsocacheiteratort iterator, aprpool_t pool) - Dump all cached objects through an iterator callback.
Modules | Directives | FAQ | Glossary | Sitemap
Apache HTTP Server Version 2.4
Modules
Modules | Directives | FAQ | Glossary | Sitemap
Shared Object Cache in Apache HTTP Server
Available Languages: en | fr
en
Available Languages: en | fr
Apache License, Version 2.0
Copyright 2014 The Apache Software Foundation.Licensed under the Apache License, Version 2.0.