cached

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cached provides caching layer for domain services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GreetingMaker

type GreetingMaker struct {
	// contains filtered or unexported fields
}

GreetingMaker uses cached value if available of fallbacks to upstream.

func NewGreetingMaker

func NewGreetingMaker(upstream greeting.Maker, cache *cache.FailoverOf[string]) *GreetingMaker

NewGreetingMaker creates an instance of cached greeting maker.

func (*GreetingMaker) GreetingMaker

func (g *GreetingMaker) GreetingMaker() greeting.Maker

GreetingMaker is a service provider.

func (*GreetingMaker) Hello

func (g *GreetingMaker) Hello(ctx context.Context, params greeting.Params) (string, error)

Hello serves greeting.

type NaiveGreetingMaker

type NaiveGreetingMaker struct {
	// contains filtered or unexported fields
}

NaiveGreetingMaker produces simple greetings.

func NewNaiveGreetingMaker

func NewNaiveGreetingMaker(upstream greeting.Maker, ttl time.Duration, stats stats.Tracker) *NaiveGreetingMaker

NewNaiveGreetingMaker creates naive greeting maker.

func (*NaiveGreetingMaker) GreetingMaker

func (g *NaiveGreetingMaker) GreetingMaker() greeting.Maker

GreetingMaker is a service provider.

func (*NaiveGreetingMaker) Hello

func (g *NaiveGreetingMaker) Hello(ctx context.Context, params greeting.Params) (string, error)

Hello makes greeting.

Jump to

Keyboard shortcuts

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