gotools/gopls/internal/util/lru/lru.go

type Cache

// Get retrieves the value for the specified key.
// If the key is found, its access time is updated.
//
// The second result reports whether the key was found.
func (c *Cache[K, V]) Get(key K) (V, bool) {}

// Set stores a value for the specified key, using its given size to update the
// current cache size, evicting old entries as necessary to fit in the cache
// capacity.
//
// Size must be a non-negative value. If size is larger than the cache
// capacity, the value is not stored and the cache is not modified.
func (c *Cache[K, V]) Set(key K, value V, size int) {}

// New creates a new Cache with the given capacity, which must be positive.
//
// The cache capacity uses arbitrary units, which are specified during the Set
// operation.
func New[K comparable, V any](capacity int) *Cache[K, V] {}

type cache

type entry

func (c *cache) get(key any) (any, bool) {}

func (c *cache) set(key, value any, size int) {}

type queue

func (q queue) Len() int {}

func (q queue) Less(i, j int) bool {}

func (q queue) Swap(i, j int) {}

func (q *queue) Push(x any) {}

func (q *queue) Pop() any {}