Skip to content

Commit 11092c1

Browse files
committed
fixed example code in README
1 parent 73addb2 commit 11092c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ import (
4848

4949
func main() {
5050
// Create a simple cache. key as string, value as int.
51-
simpleCache := simple.NewCache[string, int](simple.WithExpiration(time.Hour))
51+
simpleCache := simple.NewCache[string, int]()
5252

5353
// Create a cache for Number constraint. key as string, value as int.
5454
nc := cache.NewNumber[string, int](simpleCache)
55-
nc.Set("age", 26)
55+
nc.Set("age", 26, cache.WithExpiration(time.Hour))
5656

5757
// This will be compile error, because string is not satisfied cache.Number constraint.
5858
// nc := cache.NewNumber[string, string](simpleCache)

0 commit comments

Comments
 (0)