File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,3 +123,28 @@ func TestRedisCacheFuncWithTTLTimeout(t *testing.T) {
123123 t .Errorf ("executeCount should be 5, but get %d" , executeCount )
124124 }
125125}
126+
127+ func TestRedisCacheIntFloat (t * testing.T ) {
128+ // Original function
129+ getNum := func (i any ) (any ) {
130+ return i
131+ }
132+
133+ // Cacheable Function
134+ getNumWithCache := gofnext .CacheFn1 (
135+ getNum ,
136+ & gofnext.Config {
137+ CacheMap : gofnext .NewCacheRedis ("redis-cache-key" ).ClearAll (),
138+ },
139+ )
140+
141+ // Execute the function multi times in parallel.
142+ i := getNumWithCache (98 )
143+ if i .(int ) != 98 {
144+ t .Errorf ("i should be 98, but get %d" , i )
145+ }
146+ j := getNumWithCache (98.5 )
147+ if j .(float64 ) != 98.5 {
148+ t .Errorf ("j should be 98.5, but get %f" , j )
149+ }
150+ }
Original file line number Diff line number Diff line change 1- Subproject commit 0f8928923e78fb62f532747dba8ed62e335a3740
1+ Subproject commit 61cc6615697264a042a7b1fa74302715553ac3f2
You can’t perform that action at this time.
0 commit comments