Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client[Entity any] interface { // Get returns an entity and an error. Get(context.Context, string) (Entity, *i18np.Error) // Set sets an entity and returns an error. Handler(Handler[Entity]) Client[Entity] // Set sets an entity and returns an error. Creator(creator Creator[Entity]) Client[Entity] // Set sets an entity and returns an error. Timeout(time.Duration) Client[Entity] }
Client is an interface that defines the methods of a cache client
type Creator ¶
type Creator[Entity any] func() Entity // Creator is a function that returns an entity. It's running when the entity is found in the cache and make a pointer to it
type Service ¶
type Service interface { // Get returns a value and an error. Get(ctx context.Context, k string) (string, error) // Set sets a value and returns an error. SetEx(ctx context.Context, k string, v interface{}, d time.Duration) error // Set sets a value and returns an error. Exist(ctx context.Context, k string) (bool, error) }
Service is an interface that defines the methods of a cache service It's implemented by the cache service
Click to show internal directories.
Click to hide internal directories.