完善
This commit is contained in:
parent
a8a0a1810f
commit
aaa2b4baf3
2
cache/cache.go
vendored
2
cache/cache.go
vendored
|
@ -31,7 +31,7 @@ func (c *SliceCache[T]) FlushCache() {
|
||||||
func (c *SliceCache[T]) GetCache() []T {
|
func (c *SliceCache[T]) GetCache() []T {
|
||||||
l := len(c.data)
|
l := len(c.data)
|
||||||
expired := time.Duration(c.setTime.Unix())+c.expireTime/time.Second < time.Duration(time.Now().Unix())
|
expired := time.Duration(c.setTime.Unix())+c.expireTime/time.Second < time.Duration(time.Now().Unix())
|
||||||
if l < 1 || (l > 0 && c.expireTime > 0 && expired) {
|
if l < 1 || (l > 0 && c.expireTime >= 0 && expired) {
|
||||||
r, err := c.setCacheFunc()
|
r, err := c.setCacheFunc()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("set cache err[%s]", err)
|
log.Printf("set cache err[%s]", err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user