DiceDB / dice

DiceDB is a redis-compliant, reactive, scalable, highly-available, unified cache optimized for modern hardware.
https://dicedb.io/
Other
6.83k stars 1.08k forks source link

Inconsistent `LRU`: The command returns encoded 'OK' message instead of returning the least recently used keys #1263

Open RhythmAgg opened 1 week ago

RhythmAgg commented 1 week ago

Steps to reproduce

Expected output

The output expected is the list of keys that are least recently used ( according to the Dice DB docs ).

  1.) k1

Observed output

The output observed it the 'OK' message.

LRU command eval function

  /* /internals/eval/eval.go
    evalLRU deletes all the keys from the LRU
    returns encoded RESP OK
 */
 func evalLRU(args []string, store *dstore.Store) []byte {
    dstore.EvictAllkeysLRUOrLFU(store)
    return clientio.RespOK
 }
RhythmAgg commented 1 week ago

We can have EvictAllKeysLRUorLFU to return the list of keys and send the list to the CLI. Also the doc doesn't mention if the intended usecase is to remove all the LRU keys or just return the list to the clients for their information. @AshwinKul28 @JyotinderSingh please let me know your thoughts on this.