ring

package
v0.0.0-...-dbdf344 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringRing

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

StringRing stores the last N strings passed to Put(). It is thread-safe.

func NewStringRing

func NewStringRing(capacity int) *StringRing

NewStringRing returns a StringRing with the given capacity. Panics if the capacity is negative.

func (*StringRing) GetAll

func (r *StringRing) GetAll() []string

GetAll returns all values stored in the ring.

func (*StringRing) Put

func (r *StringRing) Put(s string)

Put appends the given value to the ring, possibly overwriting a previous value.

func (*StringRing) Write

func (r *StringRing) Write(b []byte) (int, error)

StringRing implements io.Writer for convenience.

Jump to

Keyboard shortcuts

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