2 * cache-null.c: dummy caching object for Subversion
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
24 #include "svn_private_config.h"
27 /* There is no dedicated cache data structure. Instead, we store the
28 * cache ID directly in svn_cache__t.cache_internal .
32 null_cache_get(void **value_p,
36 apr_pool_t *result_pool)
38 /* We know there is nothing to be found in this cache. */
46 null_cache_has_key(svn_boolean_t *found,
49 apr_pool_t *scratch_pool)
51 /* We know there is nothing to be found in this cache. */
57 null_cache_set(void *cache_void,
60 apr_pool_t *scratch_pool)
62 /* We won't cache anything. */
67 null_cache_iter(svn_boolean_t *completed,
69 svn_iter_apr_hash_cb_t user_cb,
71 apr_pool_t *scratch_pool)
73 /* Iteration over an empty set is a no-op. */
81 null_cache_get_partial(void **value_p,
85 svn_cache__partial_getter_func_t func,
87 apr_pool_t *result_pool)
89 /* We know there is nothing to be found in this cache. */
95 null_cache_set_partial(void *cache_void,
97 svn_cache__partial_setter_func_t func,
99 apr_pool_t *scratch_pool)
101 /* We know there is nothing to update in this cache. */
106 null_cache_is_cachable(void *cache_void,
109 /* We won't cache anything */
114 null_cache_get_info(void *cache_void,
115 svn_cache__info_t *info,
117 apr_pool_t *result_pool)
119 const char *id = cache_void;
121 info->id = apr_pstrdup(result_pool, id);
123 info->used_entries = 0;
124 info->total_entries = 0;
128 info->total_size = 0;
133 static svn_cache__vtable_t null_cache_vtable = {
138 null_cache_is_cachable,
139 null_cache_get_partial,
140 null_cache_set_partial,
145 svn_cache__create_null(svn_cache__t **cache_p,
147 apr_pool_t *result_pool)
149 svn_cache__t *cache = apr_pcalloc(result_pool, sizeof(*cache));
150 cache->vtable = &null_cache_vtable;
151 cache->cache_internal = apr_pstrdup(result_pool, id);
152 cache->pretend_empty = FALSE; /* There is no point in pretending --
153 this cache _is_ empty. */