2019-02-02 16:18:25 +08:00
|
|
|
// Copyright 2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
2018-08-30 00:00:15 +08:00
|
|
|
//
|
|
|
|
// 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,
|
2019-02-02 16:18:25 +08:00
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
2018-08-30 00:00:15 +08:00
|
|
|
|
|
|
|
package gcache
|
|
|
|
|
2019-08-13 20:15:09 +08:00
|
|
|
import (
|
|
|
|
"github.com/gogf/gf/os/gtime"
|
|
|
|
)
|
2018-08-30 00:00:15 +08:00
|
|
|
|
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.
|
2020-01-20 14:14:11 +08:00
|
|
|
if item.e >= gtime.TimestampMilli() {
|
2019-06-19 09:06:52 +08:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|