Skip to content

Commit b48e888

Browse files
authored
Merge pull request #28 from Code-Hex/fix/README
fixed README
2 parents 08190fb + b9bbb7a commit b48e888

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,31 @@ go-generics-cache is an in-memory key:value store/cache that is suitable for app
3232

3333
Go 1.18 or later.
3434

35-
If Go 1.18 has not been released but you want to try this package, you can easily do so by using the [`gotip`](https://pkg.go.dev/golang.org/dl/gotip) command.
36-
37-
```sh
38-
$ go install golang.org/dl/gotip@latest
39-
$ gotip download # latest commit
40-
$ gotip version
41-
go version devel go1.18-c2397905e0 Sat Nov 13 03:33:55 2021 +0000 darwin/arm64
42-
```
43-
4435
## Install
4536

4637
$ go get github.com/Code-Hex/go-generics-cache
4738

4839
## Usage
4940

50-
See also [examples](https://github.com/Code-Hex/go-generics-cache/blob/main/example_test.go) or [gotipplay playground](https://go.dev/play/p/MRF_I4oUS_W?v=gotip)
41+
See also [examples](https://github.com/Code-Hex/go-generics-cache/blob/main/example_test.go) or [go playground](https://go.dev/play/p/kDs-6wpRAcX)
5142

5243
```go
5344
package main
5445

5546
import (
47+
"context"
5648
"fmt"
5749
"time"
5850

5951
cache "github.com/Code-Hex/go-generics-cache"
6052
)
6153

6254
func main() {
55+
ctx, cancel := context.WithCancel(context.Background())
56+
defer cancel()
57+
6358
// use simple cache algorithm without options.
64-
c := cache.New[string, int]()
59+
c := cache.NewContext[string, int](ctx)
6560
c.Set("a", 1)
6661
gota, aok := c.Get("a")
6762
gotb, bok := c.Get("b")

0 commit comments

Comments
 (0)