neon-sunset / fast-cache

The fastest cache library written in C# for items with set expiration time. Easy to use, thread-safe and light on memory.
https://www.nuget.org/packages/FastCache.Cached/
MIT License
88 stars 8 forks source link

awaitable full clean #45

Closed troepolik closed 1 year ago

troepolik commented 1 year ago

Ability to call awaitable Full clean. To be sure it was cleared. Could you be so kind to approve it or give me feedback what can I fix in it to merge?

coveralls commented 1 year ago

Coverage Status

Coverage: 94.483% (-0.03%) from 94.511% when pulling 072e0a92bff274f49c9dce1050ef7af99bd788e7 on troepolik:main into 34cf7b793d55a8767d982a8c7a89d4b7de5eb62d on neon-sunset:main.

neon-sunset commented 1 year ago

It does make sense to expose a task to wait clear completion in place. However, you will have to add public ExecuteFullEviction too.

troepolik commented 1 year ago

Done. But for me is not so clear how to properly run eviction. Please, look at changes closer. Is I should call ImmediateFullEviction and is IsActive flag checked properly?

neon-sunset commented 1 year ago

It will require additional changes to forward either the task of Task.Run(ImmediateFullEviction<K, V>) or StaggeredFullEviction<K, V>.. However, thinking about it some more, it can probably be handled in a more graceful way by "joining" an already running full eviction if any instead of throwing/blocking and re-running/not doing anything.

For now, just remove the ExecuteFullEviction part - I will commit it separately.

troepolik commented 1 year ago

Done