Versions in this module Expand all Collapse all v1 v1.0.0 Mar 21, 2026 Changes in this version + var ErrDatabaseConfigNotProvided = errors.New("database secondary storage configuration not provided") + var ErrRedisConfigURLNotProvided = errors.New("redis secondary storage configuration URL not provided") + func NewSecondaryStorageService(providerName string, storage models.SecondaryStorage) services.SecondaryStorageService + type DatabaseSecondaryStorage struct + func NewDatabaseSecondaryStorage(db bun.IDB, config DatabaseStorageConfig) *DatabaseSecondaryStorage + func (storage *DatabaseSecondaryStorage) Close() error + func (storage *DatabaseSecondaryStorage) Delete(ctx context.Context, key string) error + func (storage *DatabaseSecondaryStorage) Get(ctx context.Context, key string) (any, error) + func (storage *DatabaseSecondaryStorage) Incr(ctx context.Context, key string, ttl *time.Duration) (int, error) + func (storage *DatabaseSecondaryStorage) Set(ctx context.Context, key string, value any, ttl *time.Duration) error + func (storage *DatabaseSecondaryStorage) StartCleanup() + func (storage *DatabaseSecondaryStorage) TTL(ctx context.Context, key string) (*time.Duration, error) + type DatabaseStorageConfig struct + CleanupInterval time.Duration + type KeyValueStore struct + CreatedAt time.Time + ExpiresAt *time.Time + Key string + UpdatedAt time.Time + Value string + type MemorySecondaryStorage struct + func NewMemorySecondaryStorage(config MemoryStorageConfig) *MemorySecondaryStorage + func (storage *MemorySecondaryStorage) Close() error + func (storage *MemorySecondaryStorage) Delete(ctx context.Context, key string) error + func (storage *MemorySecondaryStorage) Get(ctx context.Context, key string) (any, error) + func (storage *MemorySecondaryStorage) Incr(ctx context.Context, key string, ttl *time.Duration) (int, error) + func (storage *MemorySecondaryStorage) Set(ctx context.Context, key string, value any, ttl *time.Duration) error + func (storage *MemorySecondaryStorage) TTL(ctx context.Context, key string) (*time.Duration, error) + type MemoryStorageConfig struct + CleanupInterval time.Duration + type RedisSecondaryStorage struct + func NewRedisSecondaryStorage(opts RedisSecondaryStorageOptions) (*RedisSecondaryStorage, error) + func (rs *RedisSecondaryStorage) Close() error + func (rs *RedisSecondaryStorage) Delete(ctx context.Context, key string) error + func (rs *RedisSecondaryStorage) Get(ctx context.Context, key string) (any, error) + func (rs *RedisSecondaryStorage) Incr(ctx context.Context, key string, ttl *time.Duration) (int, error) + func (rs *RedisSecondaryStorage) Set(ctx context.Context, key string, value any, ttl *time.Duration) error + func (rs *RedisSecondaryStorage) TTL(ctx context.Context, key string) (*time.Duration, error) + type RedisSecondaryStorageOptions struct + MaxRetries int + PoolSize int + PoolTimeout time.Duration + URL string + type RedisStorageConfig struct + MaxRetries int + PoolSize int + PoolTimeout time.Duration + URL string + type SecondaryStorageAPI interface + GetProviderName func() string + GetStorage func() models.SecondaryStorage + type SecondaryStoragePlugin struct + func New(config SecondaryStoragePluginConfig) *SecondaryStoragePlugin + func NewWithStorage(providerName string, storage models.SecondaryStorage) *SecondaryStoragePlugin + func (p *SecondaryStoragePlugin) Close() error + func (p *SecondaryStoragePlugin) Config() any + func (p *SecondaryStoragePlugin) DependsOn() []string + func (p *SecondaryStoragePlugin) Init(ctx *models.PluginContext) error + func (p *SecondaryStoragePlugin) Metadata() models.PluginMetadata + func (p *SecondaryStoragePlugin) Migrations(provider string) []migrations.Migration + func (p *SecondaryStoragePlugin) OnConfigUpdate(config *models.Config) error + type SecondaryStoragePluginConfig struct + Database *DatabaseStorageConfig + Enabled bool + Memory *MemoryStorageConfig + Provider SecondaryStorageProvider + Redis *RedisStorageConfig + func (config *SecondaryStoragePluginConfig) ApplyDefaults() + type SecondaryStorageProvider string + const SecondaryStorageProviderDatabase + const SecondaryStorageProviderMemory + const SecondaryStorageProviderRedis + func (p SecondaryStorageProvider) String() string + type SecondaryStorageServiceImpl struct + func (s *SecondaryStorageServiceImpl) GetProviderName() string + func (s *SecondaryStorageServiceImpl) GetStorage() models.SecondaryStorage