evict

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

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

func (Handle[T]) Evict

func (h Handle[T]) Evict()

type Pool

type Pool[T any] struct {
	OnEvict func(T)
	// contains filtered or unexported fields
}

A data structure which provides amortized O(1) insertion, removal, and draining.

func (*Pool[T]) Close

func (c *Pool[T]) Close()

Close the cache, evicting all elements and evicting future elements on insertion.

func (*Pool[T]) Insert

func (c *Pool[T]) Insert(t T) (ret Handle[T])

Insert a new element into the Pool. The new element can be ejected by calling `evict`. If the element was already drained or if `evict` was already called, then `evict` will return true. Otherwise it returns false.

Jump to

Keyboard shortcuts

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