diff options
author | Joshua Colp <jcolp@digium.com> | 2015-12-05 12:01:55 -0400 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2015-12-17 14:59:12 -0400 |
commit | 59d5bb0613810418f2a618b9a6dee5bcfd45767e (patch) | |
tree | b82020dd2aef7bed6fb44ad4626eb7f2002870c5 /main | |
parent | 14b41115e363766633aec67f67e9764521b74f5c (diff) |
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
Diffstat (limited to 'main')
-rw-r--r-- | main/sorcery.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/main/sorcery.c b/main/sorcery.c index b75eb8ba7..e78fc5c6a 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -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); |