[asterisk-commits] res sorcery memory cache: Implement expire on reload option. (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 5 18:04:17 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: res_sorcery_memory_cache: Implement expire_on_reload option.
......................................................................
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
---
M res/res_sorcery_memory_cache.c
1 file changed, 9 insertions(+), 0 deletions(-)
Approvals:
Mark Michelson: Looks good to me, but someone else must approve
Matt Jordan: Looks good to me, approved; Verified
diff --git a/res/res_sorcery_memory_cache.c b/res/res_sorcery_memory_cache.c
index 57feb8f..10ef59a 100644
--- a/res/res_sorcery_memory_cache.c
+++ b/res/res_sorcery_memory_cache.c
@@ -888,6 +888,15 @@
*/
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);
}
/*!
--
To view, visit https://gerrit.asterisk.org/589
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id46aa1957d660556700e689e195eed57c989b85e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list