[] (https://travis-ci.org/jorisroovers/memclient) [] (https://godoc.org/github.com/jorisroovers/memclient)
Memclient is a simple memcached commandline client written in Go.
Memclient is very much under development and still missing some fundamental features
Installation:
# Linux
wget https://raw.githubusercontent.com/jorisroovers/memclient/bin/linux/memclient
# Mac OS X
wget https://raw.githubusercontent.com/jorisroovers/memclient/bin/osx/memclient
For the latest functionality, build memclient from source:
go build memclient.go
Example usage:
# To set a key:
memclient set mykey myvalue
# To retrieve a key:
memclient get mykey
# To delete a key
memclient delete mykey
# To list all available keys
memclient list
# Flush all keys (they will still show in 'list', but will return 'NOT FOUND' when fetched using 'memclient get')
memclient flush
# Print the server version
memclient version
Other commands:
Usage: memclient [OPTIONS] COMMAND [arg...]
Simple command-line client for Memcached
Options:
-v, --version=false Show the version and exit
--host, -h="localhost" Memcached host (or IP)
--port, -p="11211" Memcached port
Commands:
set Sets a key value pair
get Retrieves a key
delete Deletes a key
flush Flush all cache keys (they will still show in 'list', but will return 'NOT FOUND')
version Show server version
list Lists all keys
stats Print server statistics
stat Print a specific server statistic
Run 'memclient COMMAND --help' for more information on a command.
- I couldn't find a simple commandline tool for easily inspecting the data stored by a memcached server
- I was looking for a good opportunity to get some more experience with Go :-)
I'd love for you to contribute to memclient. Just open a pull request and I'll get right on it! You can find a wishlist below, but I'm obviously open to any suggestions you might have!
There is a Vagrantfile in this repository that can be used for development.
vagrant up
vagrant ssh
To run/build memclient:
go get github.com/jawher/mow.cli
go run memclient.go set foo bar
go run memclient.go get foo
go build memclient.go
To run the unit tests:
go test -v
To run the integration tests (against the memcached server in vagrant):
vagrant up
vagrant ssh
# reset memcached server and run tests
sudo systemctl restart memcached && go test -v -tags=integration
Memclient uses the Memcached protocol to talk to a memcached server.
- Pretty command output, use tables
- List: only show keys that are still active (add option to also show expired keys)
- Better error handling
- Support for other memcached commands
- Support for additional command options
- Use GoDep for dependency management
- Have a look at GoDownDoc for README generation from
doc.go
- ...