Documentation
¶
Index ¶
- Constants
- func GetMatchTTL(status string) time.Duration
- type Cache
- func (c *Cache) Delete(ctx context.Context, key string) error
- func (c *Cache) DeletePattern(ctx context.Context, pattern string) error
- func (c *Cache) Exists(ctx context.Context, key string) (bool, error)
- func (c *Cache) FlushAll(ctx context.Context) error
- func (c *Cache) Get(ctx context.Context, key string, dest interface{}) error
- func (c *Cache) GetStats(ctx context.Context) (map[string]interface{}, error)
- func (c *Cache) HealthCheck(ctx context.Context) error
- func (c *Cache) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- type CacheInterface
Constants ¶
View Source
const ( LiveMatchTTL = 5 * time.Minute FixtureTTL = 6 * time.Hour TeamInfoTTL = 24 * time.Hour LeagueTableTTL = 12 * time.Hour LineupTTL = 12 * time.Hour StandingsTTL = 6 * time.Hour NewsTTL = 30 * time.Minute DefaultTTL = 1 * time.Hour )
Cache TTL constants for different types of data
View Source
const ( StatusLive = "LIVE" StatusInPlay = "IN_PLAY" StatusScheduled = "SCHEDULED" StatusFinished = "FINISHED" )
Match status constants
Variables ¶
This section is empty.
Functions ¶
func GetMatchTTL ¶
GetMatchTTL returns the appropriate TTL based on match status
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) DeletePattern ¶
DeletePattern removes all keys matching a pattern
func (*Cache) Get ¶
Get retrieves a value from the cache by key and unmarshals it into the provided interface
func (*Cache) HealthCheck ¶
HealthCheck performs a health check on the Redis connection
type CacheInterface ¶
type CacheInterface interface { Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error Get(ctx context.Context, key string, dest interface{}) error Exists(ctx context.Context, key string) (bool, error) Delete(ctx context.Context, key string) error DeletePattern(ctx context.Context, pattern string) error FlushAll(ctx context.Context) error HealthCheck(ctx context.Context) error GetStats(ctx context.Context) (map[string]interface{}, error) }
CacheInterface defines the interface for cache operations
Click to show internal directories.
Click to hide internal directories.