dice icon indicating copy to clipboard operation
dice copied to clipboard

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

Open RhythmAgg opened this issue 1 year ago • 4 comments

Steps to reproduce

  • Connect to diceDB
  • launch dicedb-cli
  • Enter command : SET k1 v1
  • Enter command: LRU

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 avatar Nov 10 '24 09:11 RhythmAgg

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.

RhythmAgg avatar Nov 10 '24 09:11 RhythmAgg

@arpitbbhayani can I take this up... it will be a good start as a contributor

rohan-naik07 avatar Dec 01 '24 14:12 rohan-naik07

Is LRU command supported? it throws "unknown command" error.

VipinRaiP avatar Dec 24 '24 05:12 VipinRaiP

Can I take up this issue?

VipinRaiP avatar Dec 26 '24 10:12 VipinRaiP