]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: cache: Add refcount on cache_entry
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Thu, 16 Nov 2023 16:38:22 +0000 (17:38 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 16 Nov 2023 18:35:10 +0000 (19:35 +0100)
commita29b073f26d98cc4c53bf484dc18bc8de5073530
tree41213859f1bb13d22d817d36a915d0b891fd6855
parented35b9411a58b82f10bc42e245c21aa804317669
MEDIUM: cache: Add refcount on cache_entry

Add a reference counter on the cache_entry. Its value will be atomically
increased and decreased via the retain_entry and release_entry
functions.
The release_entry function has two distinct versions,
release_entry_locked and release_entry_unlocked that should be called
when the cache lock is already taken in write mode or not
(respectively). In the unlocked case the cache lock will only be taken
in write mode on the last reference of the entry (before calling
delete_entry). This allows to limit the amount of times when we need to
take the cache lock during a release operation.
src/cache.c