You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

13 lines
262 B

package utils
import (
"math/rand"
"practice_ArticleVote_Go/internal/consts"
"time"
)
func GetCacheTTL() time.Duration {
baseTTL := consts.BASE_TTL
randomNumber := rand.Intn(consts.RANDOM_RANGE)
return time.Duration(baseTTL+randomNumber) * time.Second
}