mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-22 03:15:26 +08:00
policy_cache.hpp
This commit is contained in:
parent
a4cda85ff2
commit
4370a51e22
@ -44,14 +44,19 @@ public:
|
|||||||
std::string const &val_)
|
std::string const &val_)
|
||||||
{
|
{
|
||||||
auto size = _cache.size();
|
auto size = _cache.size();
|
||||||
|
|
||||||
_cache.visit_while([&](Map::value_type const &v_)
|
while(_cache.size() > _max_size)
|
||||||
{
|
{
|
||||||
// _cache.erase(v_.first);
|
std::string key;
|
||||||
--size;
|
_cache.visit_while([&](Map::value_type const &v_)
|
||||||
fmt::print("{} > {}\n",size,_max_size);
|
{
|
||||||
return (size > _max_size);
|
key = v_.first;
|
||||||
});
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
_cache.erase(key);
|
||||||
|
fmt::print("{} > {} - {}\n",_cache.size(),_max_size,key);
|
||||||
|
}
|
||||||
|
|
||||||
_cache.insert_or_assign(key_,val_);
|
_cache.insert_or_assign(key_,val_);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user