Skip to content

Commit 51a8a83

Browse files
committed
readme: go mod
1 parent 5f72b36 commit 51a8a83

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@
55

66
This package is based on [rwz/redis-gcra](https://github.com/rwz/redis-gcra) and implements [GCRA](https://en.wikipedia.org/wiki/Generic_cell_rate_algorithm) (aka leaky bucket) for rate limiting based on Redis. The code requires Redis version 3.2 or newer since it relies on [replicate_commands](https://redis.io/commands/eval#replicating-commands-instead-of-scripts) feature.
77

8+
## Installation
9+
10+
redus_rate requires a Go version with [Modules](https://github.com/golang/go/wiki/Modules) support and uses import versioning. So please make sure to initialize a Go module before installing redis_rate:
11+
12+
``` shell
13+
go mod init github.com/my/repo
14+
go get github.com/go-redis/redis_rate/v8
15+
```
16+
17+
Import:
18+
19+
``` go
20+
import "github.com/go-redis/redis_rate/v8"
21+
```
22+
23+
## Example
24+
825
``` go
926
package redis_rate_test
1027

0 commit comments

Comments
 (0)