store

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package store provides a thread-safe fixed-capacity ring buffer. When the buffer is full, Add evicts the oldest item. A capacity of 0 means unbounded growth via append.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func NewStore

func NewStore[T any](capacity int) *Store[T]

func (*Store[T]) Add

func (s *Store[T]) Add(item T)

func (*Store[T]) Clear

func (s *Store[T]) Clear()

func (*Store[T]) Find added in v0.0.4

func (s *Store[T]) Find(match func(T) bool) (T, bool)

Find returns the first item for which match returns true, or the zero value of T and false if none match. The scan walks oldest-first.

func (*Store[T]) Len

func (s *Store[T]) Len() int

func (*Store[T]) List

func (s *Store[T]) List() []T

Jump to

Keyboard shortcuts

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