[Asterisk-code-review] res sorcery memory cache: Add support for refreshing stale o... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed May 27 15:22:35 CDT 2015


Joshua Colp has uploaded a new patch set (#5).

Change subject: res_sorcery_memory_cache: Add support for refreshing stale objects.
......................................................................

res_sorcery_memory_cache: Add support for refreshing stale objects.

This change introduces a check of object_lifetime_stale when retrieving
cached objects. If the amount of time the object has been in the cache
exceeds the lifetime, then a task is scheduled to update the cached
object based on an object retrieved from other sorcery wizards instead.

To prevent the cached object from being retrieved during a refresh,
thread-local storage is used to mark the thread as being a stale object
update. This results in the cache returning no object, leading to
sorcery querying other wizards for the object instead.

A test has been added for stale objects as well. This test ensures that
stale objects are retrieved the same as freshly-cached objects. The test
also ensures that after an object is stale, changes in the backend are
reflected in the cache, to include if the object has been deleted from
the backend.

ASTERISK-25067
Reported by Matt Jordan

Change-Id: I9bd7c049adf6939bfe2899f393c2bfbbf412d217
---
M res/res_sorcery_memory_cache.c
1 file changed, 375 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/540/5
-- 
To view, visit https://gerrit.asterisk.org/540
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9bd7c049adf6939bfe2899f393c2bfbbf412d217
Gerrit-PatchSet: 5
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list