mod_socache_memcache.c revision d6347d2d215db87038d0aff55c690c30f7ccccb6
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering/* Licensed to the Apache Software Foundation (ASF) under one or more
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* contributor license agreements. See the NOTICE file distributed with
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* this work for additional information regarding copyright ownership.
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* The ASF licenses this file to You under the Apache License, Version 2.0
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* (the "License"); you may not use this file except in compliance with
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* the License. You may obtain a copy of the License at
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* http://www.apache.org/licenses/LICENSE-2.0
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering* Unless required by applicable law or agreed to in writing, software
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering* distributed under the License is distributed on an "AS IS" BASIS,
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* See the License for the specific language governing permissions and
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering* limitations under the License.
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering/* apr_memcache support requires >= 1.3 */
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION > 2)
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering/* The underlying apr_memcache system is thread safe.. */
772f83719e3c2262d948a4c4e70fe9babc4c4610Kay Sievers const char *tag;
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poetteringstatic const char *socache_mc_create(ap_socache_instance_t **context,
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering *context = ctx = apr_palloc(p, sizeof *ctx);
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering return "List of server names required to create memcache socache.";
db1413d7380acacc4e50faf801ca0d401da89764Kay Sieversstatic apr_status_t socache_mc_init(ap_socache_instance_t *ctx,
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit);
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering /* Find all the servers in the first run to get a total count */
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering cache_config = apr_pstrdup(p, ctx->servers);
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering split = apr_strtok(cache_config, ",", &tok);
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering rv = apr_memcache_create(p, nservers, 0, &ctx->mc);
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering "SSLSessionCache: Failed to create Memcache Object of '%d' size.",
151b190e79e64824552e01849352ca8f6ac7dedbLennart Poettering /* Now add each server to the memcache */
while (split) {
char *host_str;
char *scope_id;
return rv;
return APR_EINVAL;
if (port == 0) {
&st);
return rv;
return rv;
return APR_SUCCESS;
char *cp;
for (n = 0; n < idlen; n++) {
return APR_EINVAL;
return rv;
return APR_SUCCESS;
server_rec *s,
apr_pool_t *p)
return APR_EINVAL;
if (rv) {
return rv;
return rv;
return APR_SUCCESS;
apr_pool_t *p)
buf);
#ifdef HAVE_APU_MEMCACHE
&socache_mc);