需要提高我的逻辑性能的想法
在我的应用程序中,我为每个用户 ID 创建一个映射,其中包含他有权访问的文件 ID。
示例:
用户 ID - 101 数据 - 100100101
因此,我为每个用户创建此文件映射。当该位为 1 时,他可以访问该文件;否则他不会。但我的问题是我有 40,000,000 个文件。
每当用户搜索时,都会加载相应的用户地图以产生正确的结果。如果我有 40,000 个用户,这意味着我需要创建 40,000 个地图文件。
如何为该系统创建高性能实现?
In my application, I am creating a map for each user id which contains file ids he has access to.
Example:
User ID - 101 Data - 100100101
So for each user I am creating this file map. When the bit is 1 then he has access to that file; otherwise he does not. But my problem is that I have 40,000,000 files.
Whenever the user searches, the corresponding user map will be loaded to produce the correct result. If I have 40,000 users, that means I need to create 40,000 map files.
How can I create a high performance implementation for this system?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你应该使用通用的解决方案:用户、用户组以及用户和组的角色。如果你把逻辑分成这三个部分,那就更清晰易懂了。
I think you should use common solution it is : Users, Groups of Users and Roles for Users and Groups. If you divided your logic into these 3 parts it will be more clear and understandably.
也许你说的不是德语。但只需滚动到以下文章的末尾:
http://www.activevb.de/tutorials/tut_sortalgo/sortalgo.html
并查看该项目(旧 VB 经典)。
它向您展示了排序算法之间的差异。您可以选择并比较。在这种情况下,我认为您可以选择可用于您的应用程序的哈希码(您称之为映射文件)。
无论如何,我建议尽可能使用树或子组,而不是首先需要将其解析为 3 个参数的一个数字。
问候
Perhaps you're not speaking German. But just scroll at the end of the following article:
http://www.activevb.de/tutorials/tut_sortalgo/sortalgo.html
and check out the project (Old VB classic).
It shows you differences between sorting algorithms. You can choose and compare. In this case, I think you can choose what hashcode (you call it map files) you can use for your application.
In any case, I would recommend to use trees if possible or sub-groups instead of one number which needs first to be parsed into 3 parametres.
Regards