mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-10 14:51:09 +00:00
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:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user