stringinterner

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 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 StringInterner

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

StringInterner deduplicates strings with equal value but different backing arrays, thus reducing overall memory usage if many duplicate strings are stored.

StringInterner is backed by an LRU so that only the most recently interned strings are kept.

func New

func New(cacheSize uint32) *StringInterner

New return a new *StringInterner backed by a LRU of the given size.

func (*StringInterner) Intern

func (interner *StringInterner) Intern(s string) string

Intern ensures the string is cached and returns the cached string

Jump to

Keyboard shortcuts

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