InMemoryPeekStore class final
A PeekStore that keeps at most maxEntries entries in memory.
When full, adding an entry evicts the oldest unpinned completed one, so calls still in flight and entries the user pinned are not lost. Only when nothing else is left does the oldest pending, and as a last resort the oldest pinned, entry go — the limit is never exceeded.
- Implemented types
Constructors
- InMemoryPeekStore({int maxEntries = 1000})
-
Creates a store bounded to
maxEntries, which must be positive.
Properties
-
changes
→ Stream<
PeekStoreChange> -
Every change, in order, delivered asynchronously.
no setteroverride
-
entries
→ List<
PeekEntry> -
A snapshot of every entry, oldest first.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Number of entries held.
no setteroverride
- maxEntries → int
-
The most entries the store holds before evicting.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void -
Removes every entry.
override
-
dispose(
) → void -
Closes changes. The store must not be used afterwards.
override
-
find(
PeekId id) → PeekEntry? -
The entry with
id, if held.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
PeekId id) → bool -
Removes the entry with
id; returns whether there was one.override -
toString(
) → String -
A string representation of this object.
inherited
-
upsert(
PeekEntry entry) → void -
Adds
entry, or replaces the entry with the same id in place.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited