res_sorcery_memory_cache: Add support for a full backend cache.

This change introduces the configuration option 'full_backend_cache'
which changes the cache to be a full mirror of the backend instead
of a per-object cache. This allows all sorcery retrieval operations
to be carried out against it and is useful for object types which
are used in a "retrieve all" or "retrieve some" pattern.

ASTERISK-25625 #close

Change-Id: Ie2993487e9c19de563413ad5561c7403b48caab5
This commit is contained in:
Joshua Colp
2015-12-05 12:01:55 -04:00
parent 14b41115e3
commit 59d5bb0613
4 changed files with 995 additions and 61 deletions

View File

@@ -1897,7 +1897,7 @@ void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const ch
}
}
if ((flags & AST_RETRIEVE_FLAG_MULTIPLE) || !object) {
if (((flags & AST_RETRIEVE_FLAG_MULTIPLE) && (!ao2_container_count(object) || !wizard->caching)) || !object) {
continue;
}
@@ -1935,6 +1935,10 @@ struct ao2_container *ast_sorcery_retrieve_by_regex(const struct ast_sorcery *so
}
wizard->wizard->callbacks.retrieve_regex(sorcery, wizard->data, object_type->name, objects, regex);
if (wizard->caching && ao2_container_count(objects)) {
break;
}
}
AST_VECTOR_RW_UNLOCK(&object_type->wizards);