cache_test.go 353 B

12345678910111213141516171819202122
  1. package test
  2. import (
  3. "github.com/gogf/gf/g/os/gcache"
  4. "testing"
  5. )
  6. func TestCache(t *testing.T) {
  7. t.Log("cache test ")
  8. userKey := "123123"
  9. gcache.Set(userKey, "1", 10000)
  10. if gcache.Get(userKey).(string) == userKey {
  11. t.Error("cache get error")
  12. }
  13. gcache.Remove(userKey)
  14. if gcache.Get(userKey) != nil {
  15. t.Error("cache remove error")
  16. }
  17. }