service

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedStats added in v0.9.0

type CachedStats struct {
	Stats     *entity.Stats
	ExpiresAt time.Time
}

CachedStats represents a cached statistics entry with expiration time.

type InMemoryStatsCache added in v0.9.0

type InMemoryStatsCache struct {
	// contains filtered or unexported fields
}

InMemoryStatsCache implements TTL-based in-memory caching for statistics. It provides thread-safe access and lazy cleanup of expired entries.

func NewInMemoryStatsCache added in v0.9.0

func NewInMemoryStatsCache(ttl time.Duration) *InMemoryStatsCache

NewInMemoryStatsCache creates a new in-memory cache instance.

func (*InMemoryStatsCache) Get added in v0.9.0

func (c *InMemoryStatsCache) Get(period entity.Period) *entity.Stats

Get retrieves cached statistics for the given period. Returns nil if entry doesn't exist or has expired.

func (*InMemoryStatsCache) Set added in v0.9.0

func (c *InMemoryStatsCache) Set(period entity.Period, stats *entity.Stats)

Set stores statistics in the cache for the given period.

type NoOpStatsCache added in v0.9.0

type NoOpStatsCache struct{}

NoOpStatsCache is a no-operation implementation that never caches. Used when caching is disabled via configuration.

func (*NoOpStatsCache) Get added in v0.9.0

func (c *NoOpStatsCache) Get(period entity.Period) *entity.Stats

Get always returns nil, indicating no cached data

func (*NoOpStatsCache) Set added in v0.9.0

func (c *NoOpStatsCache) Set(period entity.Period, stats *entity.Stats)

Set does nothing, as caching is disabled

type TimePeriodFactory

type TimePeriodFactory struct {
	// contains filtered or unexported fields
}

TimePeriodFactory implements PeriodFactory using timezone-aware calculations

func NewTimePeriodFactory

func NewTimePeriodFactory(timezone *time.Location) *TimePeriodFactory

NewTimePeriodFactory creates a new TimePeriodFactory with the given timezone

func (*TimePeriodFactory) CreateDaily

func (f *TimePeriodFactory) CreateDaily() entity.Period

CreateDaily creates a period for today using timezone-aware boundaries

func (*TimePeriodFactory) CreateMonthly

func (f *TimePeriodFactory) CreateMonthly() entity.Period

CreateMonthly creates a period for current month using timezone-aware boundaries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL