You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discache, is a powerfull, but simple LRU cache in golang. Using TCP and binary a as transporter which makes it very profomant.
5
+
Discache, is a powerfull, but simple LRU cache in golang. Using TCP and binary as a transporter which makes it very performant.
6
+
7
+
## CLI
8
+
A CLI tool has commands
9
+
10
+
### Requirements
11
+
- Go (version 1.17 or later)
12
+
13
+
### Makefile Targets
14
+
#### Variables
15
+
-`LISTEN_ADDR` - Address for the server to listen on (default: `:4000`).
16
+
-`LEADER_ADDR` - Address of the leader node (default: `:3000`).
17
+
18
+
These can be passed as arguments when running specific commands.
19
+
20
+
### Usage
21
+
- Build the Project
22
+
23
+
```bash
24
+
make build
25
+
```
26
+
Builds the Go binary and places it in the bin/ directory.
27
+
28
+
- Run the Project
29
+
30
+
```bash
31
+
make run
32
+
```
33
+
Runs the binary after building it.
34
+
35
+
- Run the Tests
36
+
37
+
```bash
38
+
make test
39
+
```
40
+
Runs all tests with verbose output.
41
+
42
+
- Lint the Project
43
+
44
+
```bash
45
+
make lint
46
+
```
47
+
Runs golangci-lint on the codebase. Ensure golangci-lint is installed.
48
+
49
+
- Format the Code
50
+
51
+
```bash
52
+
make fmt
53
+
```
54
+
Formats the code using go fmt.
55
+
56
+
- Clean the Build Files
57
+
58
+
```bash
59
+
make clean
60
+
```
61
+
Removes the bin/ directory and all generated files.
62
+
63
+
### Example Usage
64
+
To start a leader
65
+
```bash
66
+
make run LISTEN_ADDR=:3000
67
+
```
68
+
69
+
To start a follower node with a custom `LISTEN_ADDR` and `LEADER_ADDR`
70
+
```bash
71
+
make leader LISTEN_ADDR=:3001 LEADER_ADDR=:3000
72
+
```
6
73
7
74
## Client
8
75
A Go client for connecting to an LRU cache server over TCP. This client allows users to perform Get and Put operations on the cache, handling network communication and TTL (time-to-live) for cache entries.
0 commit comments