drivers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

FileStore implements a file-based cache store

func NewFileStore

func NewFileStore(prefix, path string) (*FileStore, error)

NewFileStore creates a new file cache store

func (*FileStore) Decrement

func (s *FileStore) Decrement(key string, value int64) (int64, error)

Decrement decrements a numeric value

func (*FileStore) Flush

func (s *FileStore) Flush() error

Flush removes all values from the cache

func (*FileStore) Forever

func (s *FileStore) Forever(key string, value interface{}) error

Forever stores a value in the cache indefinitely

func (*FileStore) Forget

func (s *FileStore) Forget(key string) error

Forget removes a value from the cache

func (*FileStore) Get

func (s *FileStore) Get(key string) (interface{}, bool)

Get retrieves a value from the cache

func (*FileStore) GetPrefix

func (s *FileStore) GetPrefix() string

GetPrefix returns the cache prefix

func (*FileStore) GetString

func (s *FileStore) GetString(key string) (string, bool)

GetString retrieves a string value from the cache

func (*FileStore) Has

func (s *FileStore) Has(key string) bool

Has checks if a key exists

func (*FileStore) Increment

func (s *FileStore) Increment(key string, value int64) (int64, error)

Increment increments a numeric value

func (*FileStore) Many

func (s *FileStore) Many(keys []string) map[string]interface{}

Many retrieves multiple values

func (*FileStore) Put

func (s *FileStore) Put(key string, value interface{}, ttl time.Duration) error

Put stores a value in the cache with a TTL

func (*FileStore) PutMany

func (s *FileStore) PutMany(items map[string]interface{}, ttl time.Duration) error

PutMany stores multiple values

func (*FileStore) Remember

func (s *FileStore) Remember(key string, ttl time.Duration, callback func() interface{}) (interface{}, error)

Remember gets from cache or computes and stores

func (*FileStore) RememberForever

func (s *FileStore) RememberForever(key string, callback func() interface{}) (interface{}, error)

RememberForever gets from cache or computes and stores forever

type MemoryStore

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

MemoryStore implements an in-memory cache store

func NewMemoryStore

func NewMemoryStore(prefix string) *MemoryStore

NewMemoryStore creates a new memory cache store

func (*MemoryStore) Close

func (s *MemoryStore) Close()

Close stops the cleanup goroutine

func (*MemoryStore) Decrement

func (s *MemoryStore) Decrement(key string, value int64) (int64, error)

Decrement decrements a numeric value

func (*MemoryStore) Flush

func (s *MemoryStore) Flush() error

Flush removes all values from the cache

func (*MemoryStore) Forever

func (s *MemoryStore) Forever(key string, value interface{}) error

Forever stores a value in the cache indefinitely

func (*MemoryStore) Forget

func (s *MemoryStore) Forget(key string) error

Forget removes a value from the cache

func (*MemoryStore) Get

func (s *MemoryStore) Get(key string) (interface{}, bool)

Get retrieves a value from the cache

func (*MemoryStore) GetPrefix

func (s *MemoryStore) GetPrefix() string

GetPrefix returns the cache prefix

func (*MemoryStore) GetString

func (s *MemoryStore) GetString(key string) (string, bool)

GetString retrieves a string value from the cache

func (*MemoryStore) Has

func (s *MemoryStore) Has(key string) bool

Has checks if a key exists

func (*MemoryStore) Increment

func (s *MemoryStore) Increment(key string, value int64) (int64, error)

Increment increments a numeric value

func (*MemoryStore) Many

func (s *MemoryStore) Many(keys []string) map[string]interface{}

Many retrieves multiple values

func (*MemoryStore) Put

func (s *MemoryStore) Put(key string, value interface{}, ttl time.Duration) error

Put stores a value in the cache with a TTL

func (*MemoryStore) PutMany

func (s *MemoryStore) PutMany(items map[string]interface{}, ttl time.Duration) error

PutMany stores multiple values

func (*MemoryStore) Remember

func (s *MemoryStore) Remember(key string, ttl time.Duration, callback func() interface{}) (interface{}, error)

Remember gets from cache or computes and stores

func (*MemoryStore) RememberForever

func (s *MemoryStore) RememberForever(key string, callback func() interface{}) (interface{}, error)

RememberForever gets from cache or computes and stores forever

type RedisStore

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

RedisStore implements a Redis-based cache store (stub for now)

func NewRedisStore

func NewRedisStore(prefix string, host string, port int, password string, database int) (*RedisStore, error)

NewRedisStore creates a new Redis cache store

func (*RedisStore) Decrement

func (s *RedisStore) Decrement(key string, value int64) (int64, error)

func (*RedisStore) Flush

func (s *RedisStore) Flush() error

func (*RedisStore) Forever

func (s *RedisStore) Forever(key string, value interface{}) error

func (*RedisStore) Forget

func (s *RedisStore) Forget(key string) error

func (*RedisStore) Get

func (s *RedisStore) Get(key string) (interface{}, bool)

func (*RedisStore) GetPrefix

func (s *RedisStore) GetPrefix() string

func (*RedisStore) GetString

func (s *RedisStore) GetString(key string) (string, bool)

func (*RedisStore) Has

func (s *RedisStore) Has(key string) bool

func (*RedisStore) Increment

func (s *RedisStore) Increment(key string, value int64) (int64, error)

func (*RedisStore) Many

func (s *RedisStore) Many(keys []string) map[string]interface{}

func (*RedisStore) Put

func (s *RedisStore) Put(key string, value interface{}, ttl time.Duration) error

func (*RedisStore) PutMany

func (s *RedisStore) PutMany(items map[string]interface{}, ttl time.Duration) error

func (*RedisStore) Remember

func (s *RedisStore) Remember(key string, ttl time.Duration, callback func() interface{}) (interface{}, error)

func (*RedisStore) RememberForever

func (s *RedisStore) RememberForever(key string, callback func() interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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