syncz

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key added in v0.0.57

type Key = interface{}

type Map added in v0.0.57

type Map[T any] interface {
	Load(key Key) (v T, ok bool)
	Len() int
	IsExpired(key Key) bool
	Store(key Key, value T)
	StoreTTL(key Key, value T, ttl time.Duration)
	LoadOrStore(key Key, value T) (v T, loaded bool)
	LoadAndDelete(key Key) (v T, loaded bool)
	Delete(key Key)
	Clear()
	Range(f func(key Key, value T) bool)
	// contains filtered or unexported methods
}

func NewMap added in v0.0.57

func NewMap[T any](ctx context.Context, opts ...NewMapOption) Map[T]

type NewMapOption added in v0.0.57

type NewMapOption interface {
	// contains filtered or unexported methods
}

func WithNewMapOptionCleanerInterval added in v0.0.57

func WithNewMapOptionCleanerInterval(interval time.Duration) NewMapOption

func WithNewMapOptionTTL added in v0.0.57

func WithNewMapOptionTTL(ttl time.Duration) NewMapOption

type Once

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

func (*Once) Do

func (o *Once) Do(f func() error) error

Do is almost identical to (*sync.Once).Do, but counts as "once" only if f does not return an error.

func (*Once) Reset

func (o *Once) Reset()

Jump to

Keyboard shortcuts

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