gf/os/gcache/gcache_adapter_memory_item.go

22 lines
614 B
Go
Raw Normal View History

// Copyright 2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gcache
import (
"github.com/gogf/gf/os/gtime"
)
2019-06-11 20:57:43 +08:00
// IsExpired checks whether <item> is expired.
2020-09-26 20:47:29 +08:00
func (item *adapterMemoryItem) IsExpired() bool {
2019-06-19 09:06:52 +08:00
// Note that it should use greater than or equal judgement here
// imagining that the cache time is only 1 millisecond.
if item.e >= gtime.TimestampMilli() {
2019-06-19 09:06:52 +08:00
return false
}
return true
}