rewriting cache to sync.Map and make all cache tests work

This commit is contained in:
dmitry 2017-11-30 15:31:14 +02:00
parent 22622817e6
commit fdb9829e38
1 changed files with 7 additions and 3 deletions

View File

@ -1762,9 +1762,13 @@ func TestGetWithExpiration(t *testing.T) {
} else if e2 := x.(int); e2+2 != 3 { } else if e2 := x.(int); e2+2 != 3 {
t.Error("e (which should be 1) plus 2 does not equal 3; value:", e2) t.Error("e (which should be 1) plus 2 does not equal 3; value:", e2)
} }
//if expiration.UnixNano() != tc.items["e"].Expiration { tmp, ok := tc.items.Load("e")
// t.Error("expiration for e is not the correct time") if ok {
//} e := tmp.(Item)
if expiration.UnixNano() != e.Expiration {
t.Error("expiration for e is not the correct time")
}
}
if expiration.UnixNano() < time.Now().UnixNano() { if expiration.UnixNano() < time.Now().UnixNano() {
t.Error("expiration for e is in the past") t.Error("expiration for e is in the past")
} }