valkey/cmake/Modules
Jim Brunner 1b5f245eae
Refactor of LFU/LRU code for modularity (#2857)
General cleanup on LRU/LFU code. Improve modularity and maintainability.

Specifically:
* Consolidates the mathematical logic for LRU/LFU into `lrulfu.c`, with
an API in `lrulfu.h`. Knowledge of the LRU/LFU implementation was
previously spread out across `db.c`, `evict.c`, `object.c`, `server.c`,
and `server.h`.
* Separates knowledge of the LRU from knowledge of the object containing
the LRU value. `lrulfu.c` knows about the LRU/LFU algorithms, without
knowing about the `robj`. `object.c` knows about the `robj` without
knowing about the details of the LRU/LFU algorithms.
* Eliminated `server.lruclock`, instead using `server.unixtime`. This
also eliminates the periodic need to call `mstime()` to maintain the lru
clock.
* Fixed a minor computation bug in the old `LFUTimeElapsed` function
(off by 1 after rollover).
* Eliminate specific IF checks for rollover, using defined behavior for
unsigned rollover instead.
* Fixed a bug in `debug.c` which would perform LFU modification on an
LRU value.

---------

Signed-off-by: Jim Brunner <brunnerj@amazon.com>
Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
2025-12-02 10:14:33 -08:00
..
Packaging.cmake Add CMake build system for valkey (#1196) 2024-11-07 18:01:37 -08:00
SourceFiles.cmake Refactor of LFU/LRU code for modularity (#2857) 2025-12-02 10:14:33 -08:00
Utils.cmake CMake fixes + README update (#1276) 2024-11-22 12:17:53 -08:00
ValkeySetup.cmake Refactor TCL reference to support running tests with CMake (#2816) 2025-12-02 14:14:28 +01:00