|
nfx-lrucache 0.1.1
High-performance C++20 thread-safe LRU cache with sliding expiration
|
Cache entry metadata with intrusive LRU list support. More...
#include <nfx/cache/LruCache.h>

Public Member Functions | |
| CacheEntry (std::chrono::milliseconds expiration=std::chrono::hours(1)) | |
| Construct cache entry with specified expiration time. | |
| bool | isExpired () const noexcept |
| Check if this cache entry has expired based on sliding expiration. | |
| void | touch () noexcept |
| Update the last accessed timestamp to current time. | |
Public Attributes | |
| std::chrono::steady_clock::time_point | lastAccessed |
| Timestamp of the last access to this cache entry. | |
| std::chrono::milliseconds | slidingExpiration |
| Sliding expiration time for this specific entry. | |
| std::size_t | size { 1 } |
| Size of this cache entry for memory accounting. | |
| CacheEntry * | lruPrev { nullptr } |
| Previous entry in the LRU doubly-linked list. | |
| CacheEntry * | lruNext { nullptr } |
| Next entry in the LRU doubly-linked list. | |
| const void * | keyPtr { nullptr } |
| Pointer to the key for this cache entry. | |
Cache entry metadata with intrusive LRU list support.
Definition at line 113 of file LruCache.h.
|
inline |
Construct cache entry with specified expiration time.
| expiration | Sliding expiration time for this entry |
|
inlinenodiscardnoexcept |
Check if this cache entry has expired based on sliding expiration.
|
inlinenoexcept |
Update the last accessed timestamp to current time.
Resets the sliding expiration timer for this cache entry


| const void* nfx::cache::CacheEntry::keyPtr { nullptr } |
Pointer to the key for this cache entry.
Definition at line 131 of file LruCache.h.
| std::chrono::steady_clock::time_point nfx::cache::CacheEntry::lastAccessed |
Timestamp of the last access to this cache entry.
Definition at line 116 of file LruCache.h.
| CacheEntry* nfx::cache::CacheEntry::lruNext { nullptr } |
Next entry in the LRU doubly-linked list.
Definition at line 128 of file LruCache.h.
| CacheEntry* nfx::cache::CacheEntry::lruPrev { nullptr } |
Previous entry in the LRU doubly-linked list.
Definition at line 125 of file LruCache.h.
| std::size_t nfx::cache::CacheEntry::size { 1 } |
Size of this cache entry for memory accounting.
Definition at line 122 of file LruCache.h.
| std::chrono::milliseconds nfx::cache::CacheEntry::slidingExpiration |
Sliding expiration time for this specific entry.
Definition at line 119 of file LruCache.h.