File tree Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change @@ -75,29 +75,6 @@ func main() {
75
75
foo := x.(*MyStruct)
76
76
// ...
77
77
}
78
-
79
- // If you store a reference type like a pointer, slice, map or channel, you
80
- // do not need to run Set if you modify the underlying data. The cached
81
- // reference points to the same memory, so if you modify a struct whose
82
- // pointer you've stored in the cache, retrieving that pointer with Get will
83
- // point you to the same data:
84
- foo := &MyStruct{Num: 1 }
85
- c.Set (" foo" , foo, cache.DefaultExpiration )
86
- // ...
87
- x , _ := c.Get (" foo" )
88
- foo := x.(*MyStruct)
89
- fmt.Println (foo.Num )
90
- // ...
91
- foo.Num ++
92
- // ...
93
- x , _ := c.Get (" foo" )
94
- foo := x.(*MyStruct)
95
- foo.Println (foo.Num )
96
-
97
- // will print:
98
- // 1
99
- // 2
100
-
101
78
}
102
79
```
103
80
You can’t perform that action at this time.
0 commit comments