Documentation ¶
Overview ¶
Package memoization implement a simple memoization cache. It's designed to improve performance in textarea.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HString ¶
type HString string
HString is a type that implements the Hasher interface for strings.
type Hasher ¶
type Hasher interface {
Hash() string
}
Hasher is an interface that requires a Hash method. The Hash method is expected to return a string representation of the hash of the object.
type MemoCache ¶
MemoCache is a struct that represents a cache with a set capacity. It uses an LRU (Least Recently Used) eviction policy. It is safe for concurrent use.
func NewMemoCache ¶
NewMemoCache is a function that creates a new MemoCache with a given capacity. It returns a pointer to the created MemoCache.
func (*MemoCache[H, T]) Get ¶
Get is a method that returns the value associated with the given hashable item in the MemoCache. If there is no corresponding value, the method returns nil.