Files

23 lines
311 B
Go
Raw Permalink Normal View History

2023-11-24 22:28:22 +08:00
package cachex_test
import (
"fmt"
"testing"
"time"
2024-05-20 22:07:57 +08:00
"github.com/yuninks/cachex"
2023-11-24 22:28:22 +08:00
)
func TestCache(t *testing.T) {
2024-04-12 16:44:21 +08:00
c := cachex.NewCache()
2023-11-24 22:28:22 +08:00
2024-04-12 16:33:00 +08:00
c.Set("test", "test", time.Second*5)
da, err := c.Get("test")
2023-12-29 16:27:47 +08:00
fmt.Println(da, err)
2023-11-24 22:28:22 +08:00
2023-12-29 16:27:47 +08:00
time.Sleep(time.Second * 5)
2024-04-12 16:33:00 +08:00
da, err = c.Get("test")
2023-12-29 16:27:47 +08:00
fmt.Println(da, err)
2023-11-24 22:28:22 +08:00
}