erni27/imcache

Do not maintain LRU queue if max entries limit less or equal to 0

Closed this issue · 0 comments

By default, a Cache doesn't have a max entries limit set. It doesn't maintain redundant data structure to apply LRU eviction policy if max entries limit exceeded.

But if a user create a new Cache with WithMaxEntriesOption with value less or equal to 0, it maintains LRU queue although it wouldn't be used.

This should be fixed and a Cache should behave exactly the same when a user doesn't specify WithMaxEntriesOption at all or provides it with value less or equal to 0.