MCPcopy Create free account
hub / github.com/apache/httpd / get_cache_value

Function get_cache_value

modules/mappers/mod_rewrite.c:1177–1213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1175}
1176
1177static char *get_cache_value(const char *name, apr_time_t t, char *key,
1178 apr_pool_t *p)
1179{
1180 cachedmap *map;
1181 char *val = NULL;
1182
1183 if (cachep) {
1184#if APR_HAS_THREADS
1185 apr_thread_mutex_lock(cachep->lock);
1186#endif
1187 map = apr_hash_get(cachep->maps, name, APR_HASH_KEY_STRING);
1188
1189 if (map) {
1190 /* if this map is outdated, forget it. */
1191 if (map->mtime != t) {
1192 apr_pool_clear(map->pool);
1193 map->entries = apr_hash_make(map->pool);
1194 map->mtime = t;
1195 }
1196 else {
1197 val = apr_hash_get(map->entries, key, APR_HASH_KEY_STRING);
1198 if (val) {
1199 /* copy the cached value into the supplied pool,
1200 * where it belongs (r->pool usually)
1201 */
1202 val = apr_pstrdup(p, val);
1203 }
1204 }
1205 }
1206
1207#if APR_HAS_THREADS
1208 apr_thread_mutex_unlock(cachep->lock);
1209#endif
1210 }
1211
1212 return val;
1213}
1214
1215static int init_cache(apr_pool_t *p)
1216{

Callers 1

lookup_mapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected