]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_sorcery_memory_cache: Add support for object_lifetime_maximum. 28/828/1
authorJoshua Colp <jcolp@digium.com>
Wed, 20 May 2015 22:35:54 +0000 (19:35 -0300)
committerMark Michelson <mmichelson@digium.com>
Wed, 8 Jul 2015 19:34:47 +0000 (14:34 -0500)
commit9a7fccc50c7ce34ca5b10efb208ba68fa750ddeb
treeecdd048b77cb00edd162b5ebe37165c3998d788b
parent9ae9221d2b53f13bf06235ce46b55d6d485c624a
res_sorcery_memory_cache: Add support for object_lifetime_maximum.

This makes the "object_lifetime_maximum" option operational.

On the addition of an object to an empty memory cache a scheduled
task is created which, when invoked, expires objects from the cache
which have exceeded their lifetime. If more objects have been added
the remaining life of the oldest object is used to schedule the
next invocation of the scheduled task.

If the oldest object is removed from the cache before it can be
expired automatically the scheduled task is cancelled, if possible,
and the lifetime of the next oldest is used to schedule the task.

If during these two operations no additional objects exist in the
cache then no task is scheduled.

An additional unit test has been added which verifies this
functionality.

ASTERISK-25067
Reported by: Matt Jordan

Change-Id: I87409674674a508e7717ee20739ca15cec6ba7b6
res/res_sorcery_memory_cache.c