2021-01-30 07:51:39 +01:00
|
|
|
//
|
|
|
|
// LRUCache.h
|
|
|
|
//
|
|
|
|
// Library: Foundation
|
|
|
|
// Package: Cache
|
|
|
|
// Module: LRUCache
|
|
|
|
//
|
|
|
|
// Definition of the LRUCache class.
|
|
|
|
//
|
|
|
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
|
|
// and Contributors.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef Foundation_LRUCache_INCLUDED
|
|
|
|
#define Foundation_LRUCache_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
#include "Poco/AbstractCache.h"
|
|
|
|
#include "Poco/LRUStrategy.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Poco {
|
|
|
|
|
|
|
|
|
|
|
|
template <
|
2023-03-23 19:19:11 +01:00
|
|
|
class TKey,
|
2021-01-30 07:51:39 +01:00
|
|
|
class TValue,
|
2023-03-23 19:19:11 +01:00
|
|
|
class TMutex = FastMutex,
|
2021-01-30 07:51:39 +01:00
|
|
|
class TEventMutex = FastMutex
|
2023-03-23 19:19:11 +01:00
|
|
|
>
|
2021-01-30 07:51:39 +01:00
|
|
|
class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>
|
|
|
|
/// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries.
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LRUCache(std::size_t size = 1024):
|
|
|
|
AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>(LRUStrategy<TKey, TValue>(size))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~LRUCache()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
LRUCache(const LRUCache& aCache);
|
|
|
|
LRUCache& operator = (const LRUCache& aCache);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Poco
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Foundation_LRUCache_INCLUDED
|