Documentation
¶
Overview ¶
Package ttl provides functionality for managing time-to-live (TTL) values in the cache. It includes utilities for validating TTL durations, calculating expiration times, and checking if values have expired.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExpirationTime ¶
GetExpirationTime calculates the expiration time for a TTL value
Types ¶
type Config ¶
type Config struct { // DefaultTTL is the default time-to-live for cache entries DefaultTTL time.Duration // MinTTL is the minimum allowed TTL value MinTTL time.Duration // MaxTTL is the maximum allowed TTL value MaxTTL time.Duration // ZeroTTLMeansNoExpiry determines if TTL of 0 means no expiry ZeroTTLMeansNoExpiry bool }
Config represents configuration for TTL behavior
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default TTL configuration
func TestConfig ¶
func TestConfig() Config
TestConfig returns a TTL configuration suitable for testing It allows shorter TTLs than the default configuration
Click to show internal directories.
Click to hide internal directories.