Does Apache.Ignite.Linq support async/await?

微笑、不失礼 提交于 2020-01-06 06:48:27

问题


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();

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?


回答1:


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;


来源:https://stackoverflow.com/questions/49100387/does-apache-ignite-linq-support-async-await

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!