Documentation
¶
Index ¶
- type FileDriver
- func (f *FileDriver) Add(_ context.Context, key string, value []byte, ttl time.Duration) (bool, error)
- func (f *FileDriver) Decrement(ctx context.Context, key string, amount int64) (int64, error)
- func (f *FileDriver) Flush(_ context.Context) error
- func (f *FileDriver) Forever(_ context.Context, key string, value []byte) error
- func (f *FileDriver) Forget(_ context.Context, key string) error
- func (f *FileDriver) Get(_ context.Context, key string) ([]byte, bool, error)
- func (f *FileDriver) Has(ctx context.Context, key string) (bool, error)
- func (f *FileDriver) Increment(_ context.Context, key string, amount int64) (int64, error)
- func (f *FileDriver) Put(_ context.Context, key string, value []byte, ttl time.Duration) error
- type MemoryDriver
- func (m *MemoryDriver) Add(_ context.Context, key string, value []byte, ttl time.Duration) (bool, error)
- func (m *MemoryDriver) Decrement(ctx context.Context, key string, amount int64) (int64, error)
- func (m *MemoryDriver) Flush(_ context.Context) error
- func (m *MemoryDriver) Forever(_ context.Context, key string, value []byte) error
- func (m *MemoryDriver) Forget(_ context.Context, key string) error
- func (m *MemoryDriver) Get(_ context.Context, key string) ([]byte, bool, error)
- func (m *MemoryDriver) Has(ctx context.Context, key string) (bool, error)
- func (m *MemoryDriver) Increment(_ context.Context, key string, amount int64) (int64, error)
- func (m *MemoryDriver) Put(_ context.Context, key string, value []byte, ttl time.Duration) error
- type RedisDriver
- func (r *RedisDriver) Add(ctx context.Context, key string, value []byte, ttl time.Duration) (bool, error)
- func (r *RedisDriver) Decrement(ctx context.Context, key string, amount int64) (int64, error)
- func (r *RedisDriver) Flush(ctx context.Context) error
- func (r *RedisDriver) Forever(ctx context.Context, key string, value []byte) error
- func (r *RedisDriver) Forget(ctx context.Context, key string) error
- func (r *RedisDriver) Get(ctx context.Context, key string) ([]byte, bool, error)
- func (r *RedisDriver) Has(ctx context.Context, key string) (bool, error)
- func (r *RedisDriver) Increment(ctx context.Context, key string, amount int64) (int64, error)
- func (r *RedisDriver) Put(ctx context.Context, key string, value []byte, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileDriver ¶
type FileDriver struct {
// contains filtered or unexported fields
}
FileDriver persists cache entries as JSON files on disk, organised in a two-level subdirectory structure: {root}/{first-2-hex}/{sha256}.json
func NewFile ¶
func NewFile(path string) (*FileDriver, error)
type MemoryDriver ¶
type MemoryDriver struct {
// contains filtered or unexported fields
}
MemoryDriver stores cache entries in memory (non-persistent, process-scoped).
func NewMemory ¶
func NewMemory() *MemoryDriver
Click to show internal directories.
Click to hide internal directories.