Documentation ¶
Index ¶
- type EntityStorage
- type ExtendedSource
- type Hit
- type HitStorage
- type Manager
- func (m *Manager[Ent, ID]) CacheQueryMany(ctx context.Context, name string, query func() iterators.Iterator[Ent]) iterators.Iterator[Ent]
- func (m *Manager[Ent, ID]) CacheQueryOne(ctx context.Context, queryID string, ...) (_ent Ent, _found bool, _err error)
- func (m *Manager[Ent, ID]) Close() error
- func (m *Manager[Ent, ID]) Create(ctx context.Context, ptr *Ent) error
- func (m *Manager[Ent, ID]) DeleteAll(ctx context.Context) error
- func (m *Manager[Ent, ID]) DeleteByID(ctx context.Context, id ID) error
- func (m *Manager[Ent, ID]) FindAll(ctx context.Context) iterators.Iterator[Ent]
- func (m *Manager[Ent, ID]) FindByID(ctx context.Context, id ID) (Ent, bool, error)
- func (m *Manager[Ent, ID]) Init(ctx context.Context) error
- func (m *Manager[Ent, ID]) SubscribeToCreatorEvents(ctx context.Context, creatorSubscriber pubsub.CreatorSubscriber[Ent]) (pubsub.Subscription, error)
- func (m *Manager[Ent, ID]) SubscribeToDeleterEvents(ctx context.Context, s pubsub.DeleterSubscriber[ID]) (pubsub.Subscription, error)
- func (m *Manager[Ent, ID]) SubscribeToUpdaterEvents(ctx context.Context, s pubsub.UpdaterSubscriber[Ent]) (pubsub.Subscription, error)
- func (m *Manager[Ent, ID]) Update(ctx context.Context, ptr *Ent) error
- type Source
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntityStorage ¶
type ExtendedSource ¶
type ExtendedSource[Ent, ID any] interface { crud.Updater[Ent] pubsub.UpdaterPublisher[Ent] }
type HitStorage ¶
type HitStorage[EntID any] interface { crud.Creator[Hit[EntID]] crud.Updater[Hit[EntID]] crud.Finder[Hit[EntID], string] crud.Deleter[string] }
HitStorage is the query hit result storage.
type Manager ¶
type Manager[Ent, ID any] struct { // Source is the location of the original data Source Source[Ent, ID] // Storage is the storage that keeps the cached data. Storage Storage[Ent, ID] // contains filtered or unexported fields }
func NewManager ¶
func (*Manager[Ent, ID]) CacheQueryMany ¶
func (*Manager[Ent, ID]) CacheQueryOne ¶
func (*Manager[Ent, ID]) DeleteByID ¶
func (*Manager[Ent, ID]) SubscribeToCreatorEvents ¶
func (m *Manager[Ent, ID]) SubscribeToCreatorEvents(ctx context.Context, creatorSubscriber pubsub.CreatorSubscriber[Ent]) (pubsub.Subscription, error)
func (*Manager[Ent, ID]) SubscribeToDeleterEvents ¶
func (m *Manager[Ent, ID]) SubscribeToDeleterEvents(ctx context.Context, s pubsub.DeleterSubscriber[ID]) (pubsub.Subscription, error)
func (*Manager[Ent, ID]) SubscribeToUpdaterEvents ¶
func (m *Manager[Ent, ID]) SubscribeToUpdaterEvents(ctx context.Context, s pubsub.UpdaterSubscriber[Ent]) (pubsub.Subscription, error)
type Source ¶
type Source[Ent, ID any] interface { crud.Creator[Ent] crud.Finder[Ent, ID] crud.Deleter[ID] pubsub.CreatorPublisher[Ent] pubsub.DeleterPublisher[ID] }
Source is the minimum expected interface that is expected from a Source resources that needs caching. On top of this, cache.Manager also supports Updater, CreatorPublisher, UpdaterPublisher and DeleterPublisher.
type Storage ¶
type Storage[Ent, ID any] interface { CacheEntity(ctx context.Context) EntityStorage[Ent, ID] CacheHit(ctx context.Context) HitStorage[ID] comproto.OnePhaseCommitProtocol }
Click to show internal directories.
Click to hide internal directories.