ttl

package
v0.0.0-...-53619cb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heap

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

func NewHeap

func NewHeap[T any](data []T, less func(x, y T) bool, key func(T) string) *Heap[T]

func (*Heap[T]) Empty

func (h *Heap[T]) Empty() bool

func (*Heap[T]) Fix

func (h *Heap[T]) Fix(i int)

func (*Heap[T]) Get

func (h *Heap[T]) Get(key string) (t T)

func (*Heap[T]) Len

func (h *Heap[T]) Len() int

func (*Heap[T]) Less

func (h *Heap[T]) Less(i, j int) bool

func (*Heap[T]) Peek

func (h *Heap[T]) Peek() (T, bool)

func (*Heap[T]) Pop

func (h *Heap[T]) Pop() (T, bool)

func (*Heap[T]) Push

func (h *Heap[T]) Push(x T)

func (*Heap[T]) Remove

func (h *Heap[T]) Remove(key string) (t T)

func (*Heap[T]) Scan

func (h *Heap[T]) Scan() []T

func (*Heap[T]) Swap

func (h *Heap[T]) Swap(i, j int)

func (*Heap[T]) Update

func (h *Heap[T]) Update(t T)

type Job

type Job struct {
	Key      string
	Schedule time.Time
}

type Runner

type Runner func(string) error

type TTL

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

func New

func New(exec Runner) *TTL

func (*TTL) Add

func (ttl *TTL) Add(job *Job)

func (*TTL) Delete

func (ttl *TTL) Delete(key string)

func (*TTL) IsExpired

func (ttl *TTL) IsExpired(key string) bool

func (*TTL) Run

func (ttl *TTL) Run() error

func (*TTL) Stop

func (ttl *TTL) Stop()

func (*TTL) Update

func (ttl *TTL) Update(job *Job)

Jump to

Keyboard shortcuts

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