Skip to content

Add inspection commands: keys, count, volume, stats - #4

Open
shubham-dce wants to merge 1 commit into
cli-03-kv-extra-commandsfrom
cli-04-inspect-commands
Open

Add inspection commands: keys, count, volume, stats#4
shubham-dce wants to merge 1 commit into
cli-03-kv-extra-commandsfrom
cli-04-inspect-commands

Conversation

@shubham-dce

Copy link
Copy Markdown
Owner

Summary

Added four read-only inspection commands related to cache: keys, count, volume, stats

Commands

  • keys - list all keys in the cache including the expired keys as well
  • count - number of items in the cache, uses __len__ under the hood.
  • volume - gives the total on-disk size of the cache, displays in KBs/MBs
  • stats - hits/misses tuple from Cache.stats(), deliberately kept read-only here as --reset is not exposed.

Notes

  • cmd_keys(cache, args) does not need to handle the Timeout exception, so no handle_timeout decorator used for that.
  • the method signature remains same for these four commands as others, to be compatible with the handler(cache, args) method in main()
  • modified the handle_timeout() decorator to be compatible with the args where 'key' does not exists.

Testing

  • Added 6 new tests to validate the implementation for these commands, including the check for the modified decorator to handle the args without keys
  • All tests passing with the coverage of 98.32%, above the project spec of 98%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants