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

Mark Michelson asteriskteam at digium.com
Wed May 27 11:44:58 CDT 2015


Mark Michelson has uploaded a new patch set (#2).

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

res_sorcery_meory_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, 370 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/540/2
-- 
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: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list