Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Set stores the given value in the cache with the specified expiration time. Set(key string, value interface{}, expiration time.Duration) error // Get retrieves the value from the cache with the specified key. Get(key string) (*CacheItem, error) // Delete removes the value from the cache with the specified key. Delete(key string) error // Flush removes all values from the cache. Flush() error // Has checks if the cache has the specified key. Has(key string) bool }
Cache interface defines the methods for interacting with the cache.
type CacheItem ¶
type CacheItem struct { Key string `json:"key"` Value interface{} `json:"value"` Expiration time.Duration `json:"expiration"` CreatedAt time.Time `json:"created_at"` }
CacheItem represents a single cache item.
type OptimizedRedisDriver ¶
type OptimizedRedisDriver struct {
// contains filtered or unexported fields
}
OptimizedRedisDriver implements the Cache interface using Redis as the storage driver with performance optimizations.
func NewOptimizedRedisDriver ¶
func NewOptimizedRedisDriver(addr, password string, db int) *OptimizedRedisDriver
NewOptimizedRedisDriver creates a new OptimizedRedisDriver instance.
func NewOptimizedRedisDriverWithOptions ¶
func NewOptimizedRedisDriverWithOptions(opt *redis.Options) *OptimizedRedisDriver
NewOptimizedRedisDriverWithOptions creates a new OptimizedRedisDriver instance with the specified options.
type RedisDriver ¶
type RedisDriver struct {
// contains filtered or unexported fields
}
RedisDriver implements the Cache interface using Redis as the storage driver.
func NewRedisDriver ¶
func NewRedisDriver(addr, password string, db int) *RedisDriver
NewRedisDriver creates a new RedisDriver instance.
func NewRedisDriverWithOptions ¶
func NewRedisDriverWithOptions(opt *redis.Options) *RedisDriver
NewRedisDriverWithOptions creates a new RedisDriver instance with the specified options.
Click to show internal directories.
Click to hide internal directories.