GoCache
is a simple Cache Server based on LRU algorithm which is also used on MemCache.
- Clone this repo:
https://github.com/kadnan/GoCache.git
go run gocached.go lru.go
- By Default it runs on port9000
with the capacity5
.- You can also specify port while running:
go run gocached.go lru.go -port=9002 -capacity=20
- get [keyname] to retrieve a key. If not available it gives a message. For example
get name
. - set [keyname] [value] to set a key. It returns
1
. For exampleset name adnan
.
-
This is my first ever Go program and also first ever implementation of LRU Cache Algorithm so do mention mistake where found or come up witha PR request.
-
There is also a sample go client available in the file
client.go
.