Commit Graph

9 Commits

Author SHA1 Message Date
Kelvin Mwinuka
e685d5041b Updated test suites to set mock server only once in each suite instead of instantiating it in every test. 2024-03-15 03:44:42 +08:00
Kelvin Mwinuka
c414da16b4 KeyExists keyspace function now removes the key if the key expiry is in the past.
KeyData type moved to utils package to allow sharing between multiple packages.
Updated all commands and command tests to pass context object to KeyExists, KeyLock, keyUnlock, KeyRLock, and KeyRUnlock.
Create context object for each test in all test suites instead of just passing context.Background() to all functions that accept a context.
2024-03-10 23:19:05 +08:00
Kelvin Mwinuka
82be1f6068 Added addedTime to EntryLFU object to control which entry will be removed if access count is the same. If two entries have the same access count, the older entry should be removed first.
SetKeyExpiry and GetValue keyspace receiver functions now require context object to be passed.
Created adjustMemoryUsage function for key eviction for LFU, LRU, and Random eviction policies.
Updated all modules to pass context to SetKeyExpirty and GetValue functions.
2024-03-08 00:26:49 +08:00
Kelvin Clement Mwinuka
e569bf6837 Added config flags max-memory and eviction-policy to manage memory usage. Created ParseMemory utility function to parse max-memory value into bytes. Created LFU cache to be used with heap data structure for managing LFU cache. 2024-03-01 16:25:04 +08:00
Kelvin Clement Mwinuka
5bb7d19953 Added tests for handleSubStr handler 2024-02-14 18:49:35 +08:00
Kelvin Clement Mwinuka
c370833e33 Added tests for handleStrLen function 2024-02-14 16:16:17 +08:00
Kelvin Clement Mwinuka
42d9bf11a1 Updated handleSetRange logic and added some test cases. 2024-02-14 16:01:11 +08:00
Kelvin Clement Mwinuka
7356cf34f5 Created test file for string commands 2024-02-13 11:29:42 +08:00
Kelvin Clement Mwinuka
fc6d81fa4a Created test file for string module 2024-02-12 21:20:22 +08:00