Skip to content

Commit 42e1f3f

Browse files
committed
Merge branch 'main' of github.com:Code-Hex/go-generics-cache into refactor/cache
2 parents 4753ee8 + 2d72735 commit 42e1f3f

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)