Import std.collections.lru_cache
std.collections.lru_cache
LruCache<K, V>: up to Capacity entries, dropping the one used least recently to make room for
a new key. Get and Add count as uses, but Peek, Contains, and going over the entries don't. Its
entries are a Map's, in the order they were last used, so a use moves an entry to the end.
std/collections/lru_cache.fb
Types
LruCache
class
@DebugEntries Public Class LruCache<K: Hashable, V> Implements Iterable<(K, V)>, Cloneable
A Map that holds up to its Capacity, letting go of the entry used least recently to make room for a new one.
std/collections/lru_cache.fb, line 11
-
An empty LruCache that holds up to
capacityentries, which must be 1 or more. -
How many entries it holds.
-
How many entries it holds at most.
-
The
key's value, or Null when it isn't there. A key that's there is used. -
The
key's value, or Null when it isn't there, without using thekey. -
Whether
keyhas an entry, which doesn't count as using it. -
Adds an entry, or gives an existing
keyits new value, and uses thekey. When that leaves more than Capacity entries, the least recently used one goes, and Add gives it, or else Null. -
Removes the
key's entry, and tells whether there was one. -
Takes every entry out.
-
Holds up to
capacityentries from now on, which must be 1 or more, dropping the least recently used ones beyond it. -
The keys, least recently used first.
-
The values, in their keys' order.
-
A new LruCache with the same entries, in the same order, and Capacity.
-
Each key and its value, least recently used first. Giving a key a new value or using one while going over them panics, as adding or removing one does.
Extends
LruCache
extend
Extend LruCache<K, V> Implements Printable
No doc comment.
std/collections/lru_cache.fb, line 107
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString.
Report an issue with this page or with FutureBlitz on GitHub.