英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论