[asterisk-commits] res sorcery memory cache: Implement expire on reload option. (asterisk[certified/13.1])
    SVN commits to the Asterisk project 
    asterisk-commits at lists.digium.com
       
    Wed Jul  8 17:19:07 CDT 2015
    
    
  
Joshua Colp 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:
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: 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/832
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id46aa1957d660556700e689e195eed57c989b85e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
    
    
More information about the asterisk-commits
mailing list