Apache.Ignite.Linq是否支持异步/等待? [英] Does Apache.Ignite.Linq support async/await?
本文介绍了Apache.Ignite.Linq是否支持异步/等待?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
2.3版的官方文档 https://apacheignite-sql.readme.io/docs /linq 指出此示例:
The official documenation of version 2.3 https://apacheignite-sql.readme.io/docs/linq states this sample:
ICache<EmployeeKey, Employee> employeeCache = ignite.GetCache<EmployeeKey, Employee>(CacheName);
IQueryable<ICacheEntry<EmployeeKey, Employee>> queryable = cache.AsCacheQueryable();
Employee[] interns = queryable.Where(emp => emp.Value.IsIntern).ToArray();
我看到ICache {TK,TV}具有大量的异步支持,并且想知道是否可以通过async/await运行Linq查询吗?
I saw that ICache{TK, TV} has plenty of async support and am wondering whether it is possible to run Linq queries with async/await?
推荐答案
Apache Ignite 没有异步Linq的方法.
Apache Ignite does not have async methods for Linq.
无论如何,您总是可以这样使用结构:
Anyway, you can always use the construction like this:
var query = queryable.Where(emp => emp.Value.IsIntern);
var task = Task.Run(() => query.ToArray());
task.Wait();
var res = task.Result;
这篇关于Apache.Ignite.Linq是否支持异步/等待?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文