ap_socache.h revision 2685f3814b77577ef7b2523442dab1ca88df1e41
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file ap_socache.h
* @brief Small object cache provider interface.
*
* @defgroup AP_SOCACHE ap_socache
* @ingroup APACHE_MODS
* @{
*/
#ifndef AP_SOCACHE_H
#define AP_SOCACHE_H
#include "httpd.h"
#include "ap_provider.h"
#include "apr_pools.h"
* the provider are NOT safe to be called concurrently from multiple
* processes or threads, and an external global mutex must be used to
* serialize access to the provider. */
#define AP_SOCACHE_FLAG_NOTMPSAFE (0x0001)
/* A cache instance. */
typedef struct ap_socache_instance_t ap_socache_instance_t;
typedef struct ap_socache_provider_t {
/* Canonical provider name: */
const char *name;
/* Bitmask of AP_SOCACHE_FLAG_* flags: */
unsigned int flags;
/* Create a session cache based on the given configuration string
* ARG. Returns NULL on success, or an error string on failure.
* Pool TMP should be used for any temporary allocations, pool P
* should be used for any allocations lasting as long as the
* lifetime of the return context.
*
* The context pointer returned in *INSTANCE will be passed as the
* first argument to subsequent invocations. */
/* Initialize the cache. Return APR error code. */
/* Destroy a given cache context. */
/* Store an object in the cache with key ID of length IDLEN, with
* DATA of length DATALEN. The object expires at abolute time
* EXPIRY. */
/* Retrieve cached object with key ID of length IDLEN, returning
* TRUE on success or FALSE otherwise. If TRUE, the data must be
* placed in DEST, which has length on entry of *DESTLEN.
* *DESTLEN must be updated to equal the length of data written on
* exit. */
apr_pool_t *pool);
/* Remove an object from the cache with key ID of length IDLEN.
* POOL may be used for temporary allocations. */
apr_pool_t *pool);
/* Dump cache status for mod_status output. */
/* Cache providers are registered using the ap_provider_* interface,
* with the following group and version: */
#define AP_SOCACHE_PROVIDER_GROUP "socache"
#define AP_SOCACHE_PROVIDER_VERSION "0"
#endif /* AP_SOCACHE_H */
/** @} */