diff options
author | Joshua Colp <jcolp@digium.com> | 2015-12-05 12:01:55 -0400 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2015-12-17 13:20:55 -0600 |
commit | 902309fd0422382eb6de4ba1d92724be437c2561 (patch) | |
tree | 4b89c31cf54a54e0d479e5238a34b0720f58d8c2 /main/sorcery.c | |
parent | 0193d97c4766c9431631aacbe1b660351f692eb5 (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/sorcery.c')
-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 b751b9f09..0f8ec5cd0 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -1901,7 +1901,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; } @@ -1939,6 +1939,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); |