Documentation
¶
Overview ¶
Package constants defines default configuration values and backend types for the hypercache system. It provides standard settings for cache expiration, eviction intervals, algorithms, and supported backend storage types.
Index ¶
Constants ¶
View Source
const ( // DefaultExpirationInterval is the default duration for cache item expiration. // Items in the cache will be considered expired after this duration if not // explicitly set otherwise. DefaultExpirationInterval = 30 * time.Minute // DefaultEvictionInterval is the default duration for cache eviction. // The cache will run its eviction process at this interval to remove // expired or least recently used items based on the configured algorithm. DefaultEvictionInterval = 10 * time.Minute // DefaultEvictionAlgorithm is the default eviction algorithm to use. // Specifies which algorithm (LRU - Least Recently Used) should be applied // when the cache needs to remove items to free up space. DefaultEvictionAlgorithm = "lru" // InMemoryBackend is the in-memory backend type. // Constant identifier for the in-memory storage backend implementation // that stores cache data directly in application memory. InMemoryBackend = "in-memory" // RedisBackend is the name of the Redis backend. // Constant identifier for the Redis storage backend implementation // that persists cache data in a Redis database server. RedisBackend = "redis" // RedisClusterBackend is the name of the Redis Cluster backend. // Constant identifier for the Redis Cluster storage backend implementation // that persists cache data across a Redis Cluster. RedisClusterBackend = "redis-cluster" // DistMemoryBackend is the name of the distributed in-memory backend (multi-node in-process simulation). DistMemoryBackend = "dist-memory" )
View Source
const ( // RedisKeySetName is the name of the Redis key set. RedisKeySetName = "hypercache" // RedisDialTimeout is the timeout for the Redis dialer. RedisDialTimeout = 10 * time.Second // RedisClientMaxRetries is the maximum number of retries for the Redis client. RedisClientMaxRetries = 10 // RedisClientReadTimeout is the read timeout for the Redis client. RedisClientReadTimeout = 30 * time.Second // RedisClientWriteTimeout is the write timeout for the Redis client. RedisClientWriteTimeout = 30 * time.Second // RedisClientPoolTimeout is the pool timeout for the Redis client. RedisClientPoolTimeout = 30 * time.Second // RedisClientPoolSize is the pool size for the Redis client. RedisClientPoolSize = 20 // RedisClientMinIdleConns is the minimum number of idle connections for the Redis client. RedisClientMinIdleConns = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SortingField ¶
type SortingField string
SortingField is a type that represents the field to sort the cache items by.
const ( SortByKey SortingField = "Key" // Sort by the key of the cache item SortBySize SortingField = "Size" // Sort by the size in bytes of the cache item SortByLastAccess SortingField = "LastAccess" // Sort by the last access time of the cache item SortByAccessCount SortingField = "AccessCount" // Sort by the number of times the cache item has been accessed SortByExpiration SortingField = "Expiration" // Sort by the expiration duration of the cache item )
Constants for the different fields that the cache items can be sorted by.
func (SortingField) String ¶
func (f SortingField) String() string
String returns the string representation of the SortingField.
type Stat ¶
type Stat string
Stat is a type that represents a different stat values that can be collected by the stats collector.
const ( // StatIncr represent a stat that should be incremented. StatIncr Stat = "incr" // StatDecr represent a stat that should be decremented. StatDecr Stat = "decr" // StatTiming represent a stat that represents the time it takes for an event to occur. StatTiming Stat = "timing" // StatGauge represent a stat that represents the current value of a statistic. StatGauge Stat = "gauge" // StatHistogram represent a stat that represents the statistical distribution of a set of values. StatHistogram Stat = "histogram" )
Click to show internal directories.
Click to hide internal directories.