mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
fixed GH #2738: Poco::AccessExpireStrategy::onGet() must not extend expiration time after expiration
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
namespace Poco {
|
||||
|
||||
|
||||
template <
|
||||
template <
|
||||
class TKey,
|
||||
class TValue
|
||||
>
|
||||
@@ -55,11 +55,14 @@ public:
|
||||
typename ExpireStrategy<TKey, TValue>::Iterator it = this->_keys.find(key);
|
||||
if (it != this->_keys.end())
|
||||
{
|
||||
this->_keyIndex.erase(it->second);
|
||||
Timestamp now;
|
||||
typename ExpireStrategy<TKey, TValue>::IndexIterator itIdx =
|
||||
this->_keyIndex.insert(typename ExpireStrategy<TKey, TValue>::TimeIndex::value_type(now, key));
|
||||
it->second = itIdx;
|
||||
if (!it->second->first.isElapsed(this->_expireTime)) // don't extend if already expired
|
||||
{
|
||||
this->_keyIndex.erase(it->second);
|
||||
Timestamp now;
|
||||
typename ExpireStrategy<TKey, TValue>::IndexIterator itIdx =
|
||||
this->_keyIndex.insert(typename ExpireStrategy<TKey, TValue>::TimeIndex::value_type(now, key));
|
||||
it->second = itIdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user