public override void OnUpdate(LoopState state) { var inj = state.Get <Injection>(); var cache = state.Get <TokenCache>(); var iter = inj.Entity.GetEnumerator(); while (iter.MoveNext()) { var src = iter.Current; Token token; if (cache.TryGetValue(src.key, out token)) { inj.Link.Push(new TokenSource { root = token }); continue; } Page page; if (!_cache.TryGetPage(cxt.pageIndex, out page)) { continue; } inj.Context.Push(new ContextSource { key = cxt.key, body = page.body, count = cxt.count, offset = cxt.offset }); } _scheduler.ExecuteFrame(_cache); }
public override void OnUpdate(LoopState state) { var inj = state.Get <Injection>(); var cache = state.Get <TokenCache>(); Parallel.ForEach(inj.Context, src => { Token token; if (!cache.TryGetValue(src.key, out token)) { _compiler.Execute(src, out token); } cache.AddOrUpdate(src.key, token); inj.Link.Push(new TokenSource { root = token }); }); }