且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在文件系统中存储​​大量的文件

更新时间:2023-11-29 16:05:22

这很容易 - 构建基于GUID的文件夹树重视的部分。

That's very easy - build a folder tree based on GUID values parts.

例如,使256个文件夹中的每个命名的第一个字节后只存储有文件,有一个GUID开始,此字节。如果这仍然是一个文件夹中的文件太多 - 为GUID的第二个字节做的每个文件夹中的一样。如果需要添加更多的水平。搜索文件将是非常快的。

For example, make 256 folders each named after the first byte and only store there files that have a GUID starting with this byte. If that's still too many files in one folder - do the same in each folder for the second byte of the GUID. Add more levels if needed. Search for a file will be very fast.

通过选择您使用的每个级别的字节数就可以有效地选择树形结构为您的方案。

By selecting the number of bytes you use for each level you can effectively choose the tree structure for your scenario.