* Returns a valid (not expired) cache_tree pointer.
* The returned entry is not retained, it should be explicitely retained only
* when necessary.
+ *
+ * This function must be called under a cache lock, either read if
+ * delete_expired==0, write otherwise.
*/
struct cache_entry *get_entry(struct cache_tree *cache_tree, char *hash, int delete_expired)
{
* is already expired, and NULL is returned. Otherwise, the expired entry is
* removed from the tree and NULL is returned.
* Returns the cache_entry in case of success, NULL otherwise.
+ *
+ * This function must be called under a cache lock, either read if
+ * delete_expired==0, write otherwise.
*/
struct cache_entry *get_secondary_entry(struct cache_tree *cache, struct cache_entry *entry,
const char *secondary_key, int delete_expired)
* Remove all expired entries from a list of duplicates.
* Return the number of alive entries in the list and sets dup_tail to the
* current last item of the list.
+ *
+ * This function must be called under a cache write lock.
*/
static unsigned int clear_expired_duplicates(struct cache_tree *cache, struct eb32_node **dup_tail)
{
* simple insert. In case of secondary entries, it will at most cost an
* insertion+max_sec_entries time checks and entry deletion.
* Returns the newly inserted node in case of success, NULL otherwise.
+ *
+ * This function must be called under a cache write lock.
*/
static struct eb32_node *insert_entry(struct cache *cache, struct cache_tree *tree, struct cache_entry *new_entry)
{
* This function removes an entry from the ebtree. If the entry was a duplicate
* (in case of Vary), it updates the secondary entry counter in another
* duplicate entry (the last entry of the dup list).
+ *
+ * This function must be called under a cache write lock.
*/
static void delete_entry(struct cache_entry *del_entry)
{