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
Click to show internal directories.
Click to hide internal directories.