-
Notifications
You must be signed in to change notification settings - Fork 62
Description
At present, foyer implements different levels of get operations through three interfaces: get/obtain/fetch:
- The get operation does not require the key to be cloneable.
- The obtain operation requires the key to be cloneable and performs deduplication optimization on requests.
- The fetch interface requires the key to be cloneable, and an additional fetch future needs to be passed in. It performs deduplication optimization on requests, as well as automatic cache fill and other optimizations.
This design is a bit complex, and it does not directly provide a shortcut for a pure in-memory path.
To simplify the design and make the interface more user-friendly, we are considering refactoring the read-related interfaces.
e.g.
All read interfaces return:
enum Get<K, V, P> {
Hit { key: K, value: V, properties: P},
Fetch { future: Box<dyn Future<Output = Result<(K, V, P)>>>},
}If get() hits directly on the pure in-memory path, Get returns directly through the Hit branch. Get implements Future, and whether it is the Hit or Fetch path, it supports poll to unify the asynchronous interface.
If get() hits directly on the pure in-memory path, Get returns directly through the Hit branch. Get implements Future, and whether it is the Hit or Fetch path, it supports poll to unify the asynchronous interface.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status