https://github.com/caldito/mimcas
Multithreaded In-Memory Cache Server
https://github.com/caldito/mimcas
cache go golang lru-cache memcached multithreading
Last synced: about 1 year ago
JSON representation
Multithreaded In-Memory Cache Server
- Host: GitHub
- URL: https://github.com/caldito/mimcas
- Owner: caldito
- License: apache-2.0
- Created: 2022-01-01T10:55:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-23T09:42:44.000Z (about 2 years ago)
- Last Synced: 2024-03-23T11:54:24.037Z (about 2 years ago)
- Topics: cache, go, golang, lru-cache, memcached, multithreading
- Language: Go
- Homepage:
- Size: 4.32 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mimcas

[](https://pkg.go.dev/github.com/caldito/mimcas)
[](https://goreportcard.com/report/github.com/caldito/mimcas)
Multithreaded In-Memory Cache Server.
Available commands:
- **set:** Sets a value for a new or existing key
- **get** Retrieves the value of a single key
- **mget** Retrieves the value of one or more keys
- **del** Removes an item from the cache
- **quit** Quit client session
- **ping** Responds "pong"
## Build
You can build the project running `make`. The binaries will then be available at `bin/mimcas-server` and `bin/mimcas-cli`.
Dependencies:
- `go` >= v1.17
- `make`
Command `make run` does the same but it will also start the server.
## Running the server
- **Option 1: Docker:** `docker run -p 20000:20000 pablogcaldito/mimcas-server:v0.1.0 [ARGUMENTS]`
- **Option 2: Download and run binary:** download from [releases page](https://github.com/caldito/mimcas/releases/) and run `./mimcas-server [ARGUMENTS]`
- **Option 3: Build from source:** `make && ./bin/mimcas-server [ARGUMENTS]`.
### Server flags
None of them are required. The available flags are:
- `-port`: Port to use for listening for incoming connections. By default it will be `20000`.
- `-maxmemory`: Maximum number of bytes available to use. Items will be evicted following LRU policy when that limit is crossed. By default there is no limit.
## Connecting with a client
The only client for now is the CLI one. It will available when building the source code as well.
- **Option 1: Docker:** `docker run --network host -it pablogcaldito/mimcas-cli:v0.1.0 mimcas-cli [ARGUMENTS]`
- **Option 2: Download and run binary:** download from [releases page](https://github.com/caldito/mimcas/releases/) and run `./mimcas-cli [ARGUMENTS]`
- **Option 3: Build from source:** `make && ./bin/mimcas-cli [ARGUMENTS]`.
### Client flags
None of them are required. The available flags are:
- `-host`: Host to use when opening a connection. By default it will be `localhost`.
- `-port`: Port to use when opening a connection. By default it will be `20000`.
### Usage example
```
>> get a
NULL
>> set a 2
OK
>> get a
OK
2
>> set b 3
OK
>> mget a b
OK
2
OK
3
>> del a
OK
>> get a
NULL
>> quit
```
## License
This project is licensed under the Apache License Version 2.0
## Contributing
Pull requests are welcomed and encouraged. For questions, feature requests and bug reports, please open an issue.
There is also a [TODO](https://github.com/caldito/mimcas/blob/main/TODO) file containing work planned to do and also [issues on GitHub](https://github.com/caldito/mimcas/issues).