evict

package
v0.22.0 Latest Latest
Warning

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

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

Documentation

Overview

Package evict is a helper package for github.com/pulumi/pulumi-go-provider/middleware/cancel.

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
}

Handle represents an entry in a Pool.

func (Handle[T]) Evict

func (h Handle[T]) Evict()

Evict the entry from the Pool.

type Pool

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

Pool is 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