utool

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 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 SliceRing added in v0.2.17

type SliceRing[T any] struct {
	// contains filtered or unexported fields
}

func NewSliceRing added in v0.2.17

func NewSliceRing[T any](capacity int) *SliceRing[T]

func (*SliceRing[T]) Add added in v0.2.17

func (r *SliceRing[T]) Add(item T)

func (*SliceRing[T]) Len added in v0.2.18

func (r *SliceRing[T]) Len() int

func (*SliceRing[T]) Peek added in v0.2.17

func (r *SliceRing[T]) Peek() (item T, ok bool)

func (*SliceRing[T]) Pop added in v0.2.17

func (r *SliceRing[T]) Pop() (item T, ok bool)

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