Margo: Rudimentary in-memory cache
The purpose if this project is getting hands on experience with Go.
One thing to be aware of when looking at the source code is that most of it is generated. The design
package contains the DSL that describes the API. The contents of the app
, client
, swagger
and tool
folders are all completely generated by the goagen tool. The storage
package contains the storage logic and is the only non-generated directory apart from the design
package.
Build
Assuming a working Go and make
setup simply:
$ make
Build artifacts will be in the build
directory.
Usage
CLI
$ ./build/margo-cli --help
CLI client for the Margo API service
Usage:
Margo [command]
Available Commands:
get Get the value of a key.
getElement Get the element of the list or dict value stored at key.
list Retrieve all keys.
remove Delete a key.
set Set the value of a key.
update Update the value of a key.
Flags:
--dump Dump HTTP request and response.
-H, --host string API hostname (default "localhost:8080")
-s, --scheme string Set the requests scheme
-t, --timeout duration Set the request timeout (default 20s)
Use "Margo [command] --help" for more information about a command.
REST
The generated documentation for the REST API is available on swagger.goa.design.
Deploy
It's recommended to use Docker to deploy the service wherever you want:
$ docker run -d -p 8080:8080 31z4/margo