2023-02-08 11:04:11 +00: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"
|
|
|
|
|
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
namespace Poco
|
|
|
|
{
|
2023-02-08 11:04:11 +00:00
|
|
|
|
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
template <class TKey, class TValue, class TMutex = FastMutex, class TEventMutex = FastMutex>
|
|
|
|
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.
|
2023-02-08 11:04:11 +00:00
|
|
|
{
|
|
|
|
public:
|
2023-02-13 09:22:33 +00:00
|
|
|
LRUCache(long size = 1024)
|
|
|
|
: AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>(LRUStrategy<TKey, TValue>(size))
|
|
|
|
{
|
|
|
|
}
|
2023-02-08 11:04:11 +00:00
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
~LRUCache() { }
|
2023-02-08 11:04:11 +00:00
|
|
|
|
|
|
|
private:
|
2023-02-13 09:22:33 +00:00
|
|
|
LRUCache(const LRUCache & aCache);
|
|
|
|
LRUCache & operator=(const LRUCache & aCache);
|
2023-02-08 11:04:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Poco
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Foundation_LRUCache_INCLUDED
|