mirror of
https://github.com/cowardmrx/rds_cache_go.git
synced 2024-09-21 19:36:39 +08:00
16 lines
229 B
Go
16 lines
229 B
Go
|
package rds_cache_go
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
// @method TTL
|
||
|
// @description: 过期时间校验
|
||
|
// @param ttl time.Duration
|
||
|
// @return time.Duration
|
||
|
func TTL(ttl time.Duration) time.Duration {
|
||
|
if ttl <= 0 {
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
return ttl
|
||
|
}
|