let mrucache age return how much elements it couldn't purge
This commit is contained in:
parent
328127980a
commit
eab6b64f6d
2 changed files with 7 additions and 5 deletions
|
|
@ -56,10 +56,12 @@ lumiera_mrucache_destroy (LumieraMruCache self)
|
||||||
/**
|
/**
|
||||||
* destroy and free the nelem oldest elements
|
* destroy and free the nelem oldest elements
|
||||||
*/
|
*/
|
||||||
void
|
int
|
||||||
lumiera_mrucache_age (LumieraMruCache self, size_t nelem)
|
lumiera_mrucache_age (LumieraMruCache self, size_t int)
|
||||||
{
|
{
|
||||||
REQUIRE (self);
|
REQUIRE (self);
|
||||||
while (self->cached && nelem--)
|
while (self->cached && nelem--)
|
||||||
free (lumiera_mrucache_pop (self));
|
free (lumiera_mrucache_pop (self));
|
||||||
|
|
||||||
|
return nelem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
* Callback function used to destruct/cleanup aged elements.
|
* Callback function used to destruct/cleanup aged elements.
|
||||||
* shall clean the element sufficiently up to be ready for being freed or reused
|
* shall clean the element sufficiently up to be ready for being freed or reused
|
||||||
* @param node the llist node used to link cache elements (will be empty at call)
|
* @param node the llist node used to link cache elements (will be empty at call)
|
||||||
* @return pointer to the begin of the element
|
* @return pointer to the begin of the element.
|
||||||
*/
|
*/
|
||||||
typedef void* (*lumiera_cache_destructor_fn)(LList node);
|
typedef void* (*lumiera_cache_destructor_fn)(LList node);
|
||||||
|
|
||||||
|
|
@ -112,8 +112,8 @@ lumiera_mrucache_pop (LumieraMruCache self)
|
||||||
/**
|
/**
|
||||||
* destroy and free the nelem oldest elements
|
* destroy and free the nelem oldest elements
|
||||||
*/
|
*/
|
||||||
void
|
int
|
||||||
lumiera_mrucache_age (LumieraMruCache self, size_t nelem);
|
lumiera_mrucache_age (LumieraMruCache self, int nelem);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue