parsecache

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Overview

Package parsecache memoises parser results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[T any] struct {
	// Limit softly caps stored entries; <= 0 means unbounded. When full, Get
	// builds without memoising.
	Limit int64
	// contains filtered or unexported fields
}

Cache is a typed memoising store. The zero value is ready and unbounded.

func (*Cache[T]) Forget

func (c *Cache[T]) Forget(spec string)

Forget drops spec's memoised result.

func (*Cache[T]) Get

func (c *Cache[T]) Get(spec string, build func() (T, error)) (T, error)

Get builds once per spec; concurrent callers share the same result.

func (*Cache[T]) Len

func (c *Cache[T]) Len() int

Len reports the number of stored entries.

type ParseFunc

type ParseFunc[T any] func() (T, error)

Jump to

Keyboard shortcuts

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