utool

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTimeCache

func NewTimeCache[T any](expire time.Duration, getter func() (T, error)) *timeCache[T]

Types

type RenewableContext

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

func CtxWithRenewableTimeout added in v0.2.13

func CtxWithRenewableTimeout(parent context.Context, timeout time.Duration) (*RenewableContext, context.CancelFunc)

func (*RenewableContext) Cancel

func (rc *RenewableContext) Cancel()

func (*RenewableContext) Deadline added in v0.2.13

func (*RenewableContext) Deadline() (deadline time.Time, ok bool)

func (*RenewableContext) Done

func (rc *RenewableContext) Done() <-chan struct{}

func (*RenewableContext) Err

func (rc *RenewableContext) Err() error

func (*RenewableContext) Renew

func (rc *RenewableContext) Renew(timeout time.Duration)

func (*RenewableContext) Value

func (rc *RenewableContext) Value(key interface{}) interface{}

type TimeCache

type TimeCache[T any] interface {
	Get() (T, error)
	Reset()
}

Jump to

Keyboard shortcuts

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