Skip to content
Snippets Groups Projects
Commit 128fe4ce authored by Joshua Colp's avatar Joshua Colp
Browse files

res_sorcery_memory_cache: Implement expire_on_reload option.

This change implements the expire_on_reload option for memory caches.
If enabled and a reload is performed all objects within the cache
will be expired and the cache emptied.

ASTERISK-25067
Reported by: Matt Jordan

Change-Id: Id46aa1957d660556700e689e195eed57c989b85e
parent 86c79314
No related branches found
No related tags found
No related merge requests found
......@@ -888,6 +888,15 @@ static void sorcery_memory_cache_load(void *data, const struct ast_sorcery *sorc
*/
static void sorcery_memory_cache_reload(void *data, const struct ast_sorcery *sorcery, const char *type)
{
struct sorcery_memory_cache *cache = data;
if (!cache->expire_on_reload) {
return;
}
ao2_wrlock(cache->objects);
remove_all_from_cache(cache);
ao2_unlock(cache->objects);
}
/*!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment