Skip to content

Commit 6384f11

Browse files
committed
chore: example
1 parent d0aaa92 commit 6384f11

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,29 @@ Roc is a key-value memory cache.
88
* Quick GC
99

1010
## Usage
11+
```go
12+
package main
13+
14+
import (
15+
"fmt"
16+
"github.com/xiaojiaoyu100/roc"
17+
"time"
18+
)
19+
20+
func main() {
21+
cache, err := roc.New()
22+
if err != nil {
23+
fmt.Println(err)
24+
return
25+
}
26+
if err := cache.Set("myfirstkey", "123", time.Second*3); err != nil {
27+
fmt.Println(err)
28+
return
29+
}
30+
fmt.Println(cache.Get("myfirstkey"))
31+
fmt.Println(cache.Del("myfirstkey"))
32+
fmt.Println(cache.Get("myfirstkey"))
33+
}
34+
```
1135

1236

0 commit comments

Comments
 (0)