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.
This commit is contained in:
Kelvin Mwinuka
2024-03-10 23:19:05 +08:00
parent 10f1aeab9e
commit c414da16b4
19 changed files with 1148 additions and 871 deletions

View File

@@ -98,12 +98,11 @@ There is no limit by default.`, func(memory string) error {
4) volatile-lfu - Evict the least frequently used keys with an expiration.
5) volatile-lru - Evict the least recently used keys with an expiration.
6) allkeys-random - Evict random keys until we get under the max-memory limit.
7) volatile-random - Evict random keys with an expiration.
8) volatile-ttl - Evict the keys with the shortest remaining ttl.`, func(policy string) error {
7) volatile-random - Evict random keys with an expiration.`, func(policy string) error {
policies := []string{
NoEviction,
AllKeysLFU, AllKeysLRU, AllKeysRandom,
VolatileLFU, VolatileLRU, VolatileRandom, VolatileTTL,
VolatileLFU, VolatileLRU, VolatileRandom,
}
policyIdx := slices.Index(policies, strings.ToLower(policy))
if policyIdx == -1 {