memclient

command module
v0.0.0-...-67a064b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

memclient

[Build Status] (https://travis-ci.org/jorisroovers/memclient) [GoDoc] (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.

Why memclient?

  1. I couldn't find a simple commandline tool for easily inspecting the data stored by a memcached server
  2. I was looking for a good opportunity to get some more experience with Go :-)

Contributing

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!

Development

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.

Wishlist

  • 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
  • ...

Documentation

Overview

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

Example usage

# To set a key:
memclient set mykey myvalue
# To retrieve a key:
memclient get mykey
# To list all available keys
memclient list

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL