/* 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * 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.
*/
#if !defined(DISTCACHE_CLIENT_API) || (DISTCACHE_CLIENT_API < 0x0001) #error"You must compile with a more recent version of the distcache-base package" #endif
static apr_status_t socache_dc_init(ap_socache_instance_t *ctx, constchar *namespace, conststruct ap_socache_hints *hints,
server_rec *s, apr_pool_t *p)
{ #if 0 /* If a "persistent connection" mode of operation is preferred, you *must* * also use the PIDCHECK flag to ensure fork()'d processes don't interlace
* comms on the same connection as each other. */ #define SESSION_CTX_FLAGS SESSION_CTX_FLAG_PERSISTENT | \
SESSION_CTX_FLAG_PERSISTENT_PIDCHECK | \
SESSION_CTX_FLAG_PERSISTENT_RETRY | \
SESSION_CTX_FLAG_PERSISTENT_LATE #else /* This mode of operation will open a temporary connection to the 'target' * for each cache operation - this makes it safe against fork() * automatically. This mode is preferred when running a local proxy (over * unix domain sockets) because overhead is negligible and it reduces the
* performance/stability danger of file-descriptor bloatage. */ #define SESSION_CTX_FLAGS 0 #endif
ctx->dc = DC_CTX_new(ctx->target, SESSION_CTX_FLAGS); if (!ctx->dc) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00738) "distributed scache failed to obtain context"); return APR_EGENERAL;
}
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, APLOGNO(00739) "distributed scache context initialised");
static apr_status_t socache_dc_store(ap_socache_instance_t *ctx, server_rec *s, constunsignedchar *id, unsignedint idlen,
apr_time_t expiry, unsignedchar *der, unsignedint der_len,
apr_pool_t *p)
{ /* !@#$%^ - why do we deal with *absolute* time anyway??? * Uhm - because most things expire things at a specific time? * Were the API were thought out expiry - r->request_time is a good approximation
*/
expiry -= apr_time_now(); /* Send the serialised session to the distributed cache context */ if (!DC_CTX_add_session(ctx->dc, id, idlen, der, der_len,
apr_time_msec(expiry))) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00740) "distributed scache 'store' failed"); return APR_EGENERAL;
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00741) "distributed scache 'store' successful"); return APR_SUCCESS;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.