[Asterisk-code-review] res sorcery memory cache: Add support for maximum objects. (asterisk[master])

Mark Michelson asteriskteam at digium.com
Fri May 22 09:48:30 CDT 2015


Hello Joshua Colp,

I'd like you to reexamine a change.  Please visit

    https://gerrit.asterisk.org/498

to look at the new patch set (#4).

Change subject: res_sorcery_memory_cache: Add support for maximum_objects.
......................................................................

res_sorcery_memory_cache: Add support for maximum_objects.

This makes the "maximum_objects" option operational.

A heap has been added alongside the hash table in the cache. When
objects are added to the cache, they are also added to the heap.
Similarly, when objects are removed from the cache, they are removed
from the heap.

The heap's use comes into play when an item is to be added to a "full"
cache. When the cache is full, the oldest item is removed from the
cache, using the heap to determine the oldest item.

A unit test has been added that verifies that the maximum_objects option
works as expected and that the oldest object is removed from the cache
when an object beyond the maximum is added.

ASTERISK-25067 #close
Reported by Matt Jordan

Change-Id: I490658830e9c4cbf0b3051e4cdc4913cf9f1b73a
---
M res/res_sorcery_memory_cache.c
1 file changed, 297 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/98/498/4
-- 
To view, visit https://gerrit.asterisk.org/498
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I490658830e9c4cbf0b3051e4cdc4913cf9f1b73a
Gerrit-PatchSet: 4
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