Golang in-memory database.
$ go install github.com/KyriakosMilad/memdb
verify installation:
$ memdb
You can start the server using memdb
command
$ memdb
The default listening port is 3636, But if you want you can specify the listening port using port
option
$ memdb -port 3636
$ telnet 127.0.0.1 3636
127.0.0.1 is the host
3636 is the listening port
Set value in the database.
syntax set [key] [value]
example
$ set x 5
output:
OK
Get value from the database using key.
syntax: get [key]
if key exists it's value will be returned, if key does not exist key [key] not found
will be returned.
example
$ get x
output:
5
example2
$ get y
output2:
key y not found
Delete value from the database using key.
syntax delete [key]
example
$ delete x
output:
OK
now if you try to get x's value
$ get x
output:
key x not found
close the connection to the server
$ exit
You can stop the server by stopping the running process (CTRL + C)
$ ^C
output
stopping memdb
removing all clients
removed all clients successfully
saving database on the desk
successfully saved database on the disk
closing the tcp listener
closed tcp listener successfully
exiting