cachecore

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 2 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	DefaultTTL    time.Duration
	Prefix        string
	Compression   CompressionCodec
	MaxValueBytes int
	EncryptionKey []byte
}

BaseConfig contains shared, backend-agnostic driver configuration.

type CompressionCodec

type CompressionCodec string

CompressionCodec represents a value compression algorithm.

const (
	CompressionNone   CompressionCodec = "none"
	CompressionGzip   CompressionCodec = "gzip"
	CompressionSnappy CompressionCodec = "snappy"
)

type Driver

type Driver string

Driver identifies cache backend.

const (
	DriverNull      Driver = "null"
	DriverFile      Driver = "file"
	DriverMemory    Driver = "memory"
	DriverMemcached Driver = "memcached"
	DriverDynamo    Driver = "dynamodb"
	DriverSQL       Driver = "sql"
	DriverRedis     Driver = "redis"
	DriverNATS      Driver = "nats"
)

type Store

type Store interface {
	Driver() Driver
	Ready(ctx context.Context) error
	Get(ctx context.Context, key string) ([]byte, bool, error)
	Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
	Add(ctx context.Context, key string, value []byte, ttl time.Duration) (bool, error)
	Increment(ctx context.Context, key string, delta int64, ttl time.Duration) (int64, error)
	Decrement(ctx context.Context, key string, delta int64, ttl time.Duration) (int64, error)
	Delete(ctx context.Context, key string) error
	DeleteMany(ctx context.Context, keys ...string) error
	Flush(ctx context.Context) error
}

Store is the shared app cache contract.

Jump to

Keyboard shortcuts

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