Closed kevinresol closed 6 years ago
Hmm, I wonder if it's might be better to do it this way:
function cache<T>(gen:Void->Promise<Pair<T, Future<Noise>>):Void->Promise<T> { ... }
Mostly because otherwise if expiration should be somehow tied to data, you have to share state between the functions somehow. But I'm just thinking out loud.
Updated, also allowed sync expire
Well Java choked on this:
src/tink/core/_Promise/Promise_Impl_.java:309: error: generic array creation
tink.core._Future.FutureObject<tink.core.Outcome>[] p = ( (tink.core._Future.FutureObject<tink.core.Outcome>[]) (new tink.core._Future.FutureObject<tink.core.Outcome>[] {null}) );
^
Gotta love hxjava \o/
Promise.cache
returns a function which when called:Sample use: