Summary:
There was a bug when if the entry with the same key is present in the hash and
the hash is full, then some entry will be evicted even though it's not
necessary.
It adds one hash map lookup, but it shouldn't be a big problem
Reviewed By: jsgf
Differential Revision: D6702001
fbshipit-source-id: 1c8cadc5e4bad6f6d95279b21edf00ed99f62c49
Summary:
In the next diff we'll `task::current()` inside MemoFuture. It fails if no
task exists. Let's use spawn to create a Task for each future.
Reviewed By: jsgf
Differential Revision: D6611510
fbshipit-source-id: 95a825dff9714579e9b16e74f355c54d8fa83a24
Summary: Previously inserting the same key twice will add size of this key twice. This diff fixes it.
Reviewed By: jsgf
Differential Revision: D6602501
fbshipit-source-id: eb8f785296945bca1df4b6cd33bd3050a48e2174
Summary: Add a unit test for failing to compute a value.
Reviewed By: Imxset21
Differential Revision: D5717910
fbshipit-source-id: cb5b1560a539f4b99d87dc2f8fc0afd37f4b5b97
Summary:
Pass a reference to the cache to the fill function. This allows the
function to be recursive based on memoized values.
This also required quite a bit of restructuring to make sure that locks
and ownership are handled properly during recursive calls. Specifically,
a new `Slot` state - `Polling` - is used to indicate when a thread/task
is currently calling `.poll()` on the future. This contains a list of
futures Tasks which are interested in the state of the slot which can be
notified when it changes state.
Also removed unused Entry API code.
Reviewed By: sid0
Differential Revision: D5652704
fbshipit-source-id: 29cd3fe37d4eb9316235872b7e2e228bf10a016f