mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
policy_cache.hpp
This commit is contained in:
parent
708e7fbfa6
commit
4d631744b0
1 changed files with 4 additions and 1 deletions
|
|
@ -41,10 +41,13 @@ public:
|
|||
insert(std::string const &key_,
|
||||
std::string const &val_)
|
||||
{
|
||||
auto size = _cache.size();
|
||||
|
||||
_cache.visit_while([&](Map::value_type const &v_)
|
||||
{
|
||||
_cache.erase(v_.first);
|
||||
return (_cache.size() > _max_size);
|
||||
--size;
|
||||
return (size > _max_size);
|
||||
});
|
||||
|
||||
_cache.insert_or_assign(key_,val_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue