@@ -87,12 +87,22 @@ class ObjectStorageListObjectsCachePolicy : public TTLCachePolicy<Key, Mapped, H
87
87
88
88
for (auto it = cache.begin (); it != cache.end (); ++it)
89
89
{
90
+ const auto & candidate_bucket = it->first .bucket ;
90
91
const auto & candidate_prefix = it->first .prefix ;
91
92
92
- if (prefix. starts_with (candidate_prefix) && candidate_prefix. size () > best_length )
93
+ if (candidate_bucket == key. bucket && prefix. starts_with (candidate_prefix) )
93
94
{
94
- best_match = it;
95
- best_length = candidate_prefix.size ();
95
+ if (IsStaleFunction ()(it->fist ))
96
+ {
97
+ BasePolicy::remove (it->first );
98
+ continue ;
99
+ }
100
+
101
+ if (candidate_prefix.size () > best_length)
102
+ {
103
+ best_match = it;
104
+ best_length = candidate_prefix.size ();
105
+ }
96
106
}
97
107
}
98
108
@@ -101,12 +111,19 @@ class ObjectStorageListObjectsCachePolicy : public TTLCachePolicy<Key, Mapped, H
101
111
102
112
auto findAnyMatchingPrefix (const Key & key) const
103
113
{
114
+ const auto & bucket = key.bucket ;
104
115
const auto & prefix = key.prefix ;
105
116
return std::find_if (cache.begin (), cache.end (), [&](const auto & it)
106
117
{
118
+ const auto & candidate_bucket = it.first .bucket ;
107
119
const auto & candidate_prefix = it.first .prefix ;
108
- if (prefix.starts_with (candidate_prefix))
120
+ if (candidate_bucket == key. bucket && prefix.starts_with (candidate_prefix))
109
121
{
122
+ if (IsStaleFunction ()(it->fist ))
123
+ {
124
+ BasePolicy::remove (it->first );
125
+ continue ;
126
+ }
110
127
return true ;
111
128
}
112
129
0 commit comments