Documentation
¶
Index ¶
- Constants
- Variables
- func FieldKey(field *ast.Field, vars map[string]any) (string, error)
- func QueryKey(query string, vars map[string]any) (string, error)
- type BackendType
- type CacheItem
- type Config
- type Info
- type L1Config
- type L2Config
- type Option
- type Options
- type Service
- func (s *Service) AsModule() bool
- func (s *Service) Attach(ctx context.Context, pool *db.Pool) error
- func (s *Service) Catalog(ctx context.Context) cs.Source
- func (s *Service) Delete(ctx context.Context, key string) error
- func (s *Service) Engine() engines.Engine
- func (s *Service) Get(ctx context.Context, key string) (any, error)
- func (s *Service) Init(ctx context.Context) error
- func (s *Service) Invalidate(ctx context.Context, tags ...string) error
- func (s *Service) IsReadonly() bool
- func (s *Service) Load(ctx context.Context, key string, fn func() (any, error), options ...Option) (any, error)
- func (s *Service) Name() string
- func (s *Service) Set(ctx context.Context, key string, data any, options ...Option) error
Constants ¶
View Source
const ( ItemDataTypeMap = iota ItemDataTypeArrowTable ItemDataTypeJsonValue ItemDataTypeBytes ItemDataTypeString ItemDataTypeResponse ItemNil )
Variables ¶
View Source
var ErrMissCache = errors.New("Key not found in cache")
View Source
var (
ErrNoCacheConfigured = errors.New("no cache configured")
)
Functions ¶
Types ¶
type BackendType ¶
type BackendType string
const ( L2RedisBackend BackendType = "redis" L2MemcachedBackend BackendType = "memcached" )
type CacheItem ¶
func NewCacheItem ¶
func (*CacheItem) DecodeMsgpack ¶
func (*CacheItem) EncodeMsgpack ¶
type Config ¶
type L1Config ¶
type L1Config struct {
Enabled bool `json:"enabled"`
MaxSize int `json:"max_size"` // Maximum size of the cache Megabytes
MaxItemSize int `json:"max_item_size"` // Maximum size of an item in the cache
Shards int `json:"shards"` // Number of shards in the cache
CleanTime types.Interval `json:"clean_time"` // Time to clean the cache
EvictionTime types.Interval `json:"eviction_time"` // Time to evict items from the cache
}
type L2Config ¶
type L2Config struct {
Enabled bool `json:"enabled"`
Backend BackendType `json:"backend"` // Backend type for the L2 cache
Addresses []string `json:"addresses"` // Addresses for the L2 cache
Database int `json:"database"` // Database for the L2 cache (for Redis)
Username string `json:"username"` // Username for the L2 cache (for Redis)
Password string `json:"password"` // Password for the L2 cache (for Redis)
}
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func ApplyOptions ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Invalidate ¶
func (*Service) IsReadonly ¶
Click to show internal directories.
Click to hide internal directories.