FileApiCacheStore class
One file per answer, <root>/answers/<key hash>.json, and the owner in
<root>/owner.json.
Names are hashes because keys are arbitrary text (a key can carry a request body). Each file repeats its key, so the rare collision reads as a miss rather than as another request's answer. Writes go to a temporary file that is renamed into place, so a crash mid-write leaves the previous file, never half of one.
- Implemented types
Constructors
-
FileApiCacheStore(FutureOr<
Directory> root) -
FileApiCacheStore.locatedBy(FutureOr<
Directory> locate()) - A store whose directory is found on first use, so creating one asks nothing of the platform.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> -
Removes every answer. The owner is left as it is.
override
-
get(
String key) → Future< StoredAnswer?> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prune(
{required DateTime savedBefore}) → Future< void> -
Removes every answer saved before
savedBefore.override -
put(
String key, StoredAnswer answer) → Future< void> -
override
-
readOwner(
) → Future< String?> -
The identity the saved answers belong to, as last written.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
writeOwner(
String? owner) → Future< void> -
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited