| 1 | // |
| 2 | // LRUCache.h |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: Cache |
| 6 | // Module: LRUCache |
| 7 | // |
| 8 | // Definition of the LRUCache class. |
| 9 | // |
| 10 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Foundation_LRUCache_INCLUDED |
| 18 | #define Foundation_LRUCache_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/AbstractCache.h" |
| 22 | #include "Poco/LRUStrategy.h" |
| 23 | |
| 24 | |
| 25 | namespace Poco { |
| 26 | |
| 27 | |
| 28 | template < |
| 29 | class TKey, |
| 30 | class TValue, |
| 31 | class TMutex = FastMutex, |
| 32 | class TEventMutex = FastMutex |
| 33 | > |
| 34 | class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex> |
| 35 | /// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries. |
| 36 | { |
| 37 | public: |
| 38 | LRUCache(std::size_t size = 1024): |
| 39 | AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>(LRUStrategy<TKey, TValue>(size)) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | ~LRUCache() |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | private: |
| 48 | LRUCache(const LRUCache& aCache); |
| 49 | LRUCache& operator = (const LRUCache& aCache); |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | } // namespace Poco |
| 54 | |
| 55 | |
| 56 | #endif // Foundation_LRUCache_INCLUDED |
| 57 | |