Documentation
¶
Index ¶
- Variables
- func WithBatch[K interface{}, V interface{}, C comparable](useBatch bool) option[K, V, C]
- func WithBatchScheduleFn[K interface{}, V interface{}, C comparable](batchScheduleFn BatchScheduleFn) option[K, V, C]
- func WithCacheKeyFn[K interface{}, V interface{}, C comparable](cacheKeyFn CacheKeyFn[K, C]) option[K, V, C]
- func WithCacheMap[K interface{}, V interface{}, C comparable](cacheMap CacheMap[C, *Thunk[V]]) option[K, V, C]
- func WithMaxBatchSize[K interface{}, V interface{}, C comparable](maxBatchSize int) option[K, V, C]
- type Batch
- type BatchLoadFn
- type BatchScheduleFn
- type CacheKeyFn
- type CacheKeyFunc
- type CacheMap
- type DataLoader
- type InMemoryCache
- type NoCache
- type Result
- type Thunk
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUncomparableKey = errors.New("cannot use uncomparable key in mirror cache key function") ErrUnconvertibleKey = errors.New("cannot use convert key to cache key function") )
Functions ¶
func WithBatch ¶
func WithBatch[K interface{}, V interface{}, C comparable](useBatch bool) option[K, V, C]
func WithBatchScheduleFn ¶
func WithBatchScheduleFn[K interface{}, V interface{}, C comparable](batchScheduleFn BatchScheduleFn) option[K, V, C]
func WithCacheKeyFn ¶
func WithCacheKeyFn[K interface{}, V interface{}, C comparable](cacheKeyFn CacheKeyFn[K, C]) option[K, V, C]
func WithCacheMap ¶
func WithCacheMap[K interface{}, V interface{}, C comparable](cacheMap CacheMap[C, *Thunk[V]]) option[K, V, C]
func WithMaxBatchSize ¶
func WithMaxBatchSize[K interface{}, V interface{}, C comparable](maxBatchSize int) option[K, V, C]
Types ¶
type BatchLoadFn ¶
type BatchScheduleFn ¶
func NewTimeWindowScheduler ¶
func NewTimeWindowScheduler(t time.Duration) BatchScheduleFn
type CacheKeyFn ¶
type CacheKeyFn[K interface{}, C comparable] func(ctx context.Context, key K) (C, error)
func NewMirrorCacheKey ¶
func NewMirrorCacheKey[K interface{}, C comparable]() CacheKeyFn[K, C]
type CacheKeyFunc ¶
type CacheKeyFunc[K interface{}, C comparable] func(ctx context.Context, key K) (C, error)
type DataLoader ¶
type DataLoader[K interface{}, V interface{}, C comparable] interface { Load(context.Context, K) *Thunk[V] LoadMany(context.Context, []K) []*Thunk[V] Clear(context.Context, K) DataLoader[K, V, C] ClearAll(ctx context.Context) DataLoader[K, V, C] Prime(context.Context, K, V) DataLoader[K, V, C] Dispatch() }
func New ¶
func New[K interface{}, V interface{}, C comparable](ctx context.Context, batchLoadFn BatchLoadFn[K, V], options ...option[K, V, C]) DataLoader[K, V, C]
type InMemoryCache ¶
type InMemoryCache[C comparable, V interface{}] struct { // contains filtered or unexported fields }
func NewInMemoryCache ¶
func NewInMemoryCache[C comparable, V interface{}]() *InMemoryCache[C, V]
func (*InMemoryCache[C, V]) Delete ¶
func (c *InMemoryCache[C, V]) Delete(ctx context.Context, key C) error
type NoCache ¶
type NoCache[C comparable, V interface{}] struct{}
func NewNoCache ¶
func NewNoCache[C comparable, V interface{}]() *NoCache[C, V]
Click to show internal directories.
Click to hide internal directories.