cached

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 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
}

func NewNaiveGreetingMaker

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

func (*NaiveGreetingMaker) GreetingMaker

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

func (*NaiveGreetingMaker) Hello

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

Jump to

Keyboard shortcuts

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