如何从IgniteCache中获取特定类型的所有条目的数量?

huangapple go评论81阅读模式
英文:

How to get amount of all entries of a certain type from IgniteCache?

问题

我有一个 IgniteCache<T1, T2> 缓存,其中包含不同类型的数据,包括已登录用户的授权令牌(IgniteCache<UUID, List<'SomeObject'>>)。我想要获取关于我有多少经过授权的用户的统计信息,所以我想要从我的缓存中获取所有这些令牌并对它们进行计数。我应该如何做到这一点?

英文:

I have IgniteCache<T1, T2> cache where data of different types is placed including the auth tokens of logged-in users (IgniteCache<UUID, List<'SomeObject'>>).
I want to get statistic about how many authorized users I have, so I want to get from my cache all this tokens and count them. How can I do this?

答案1

得分: 3

你可以发起一个扫描查询,回调函数只会计算包含令牌的条目。

为了加速操作,你可以为每个缓存分区发起一个亲和运行,以确保没有数据通过网络发送。

英文:

You can issue a Scan Query where the callback will only count entries containing token.

To speed it up, you can issue an Affinity Run for every cache partition to make sure no data is sent via network.

huangapple
  • 本文由 发表于 2020年8月4日 17:25:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/63243855.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定