测量网络应用程序用户使用了多少磁盘空间的最佳方法?
我想知道,人们使用什么方法来测量人们在网络应用程序帐户中使用了多少磁盘空间?例如,如果我想将 Web 应用程序的存储上限限制为 5GB,您会如何跟踪该使用情况?
谢谢!
I was wondering, what methods do people use for measuring how much disk space people are using in their account for a web app? For instance, if I want to cap a web app at 5GB of storage, what would you do to track that usage?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在允许用户上传新文件之前,您可以循环遍历所有用户上传的文件,总结它们的文件大小并检查他是否在配额内。
或者,您可以通过在用户从其帐户上传/删除文件时添加/减去文件大小来存储他已使用的容量,并将这段数据存储在数据库中。
You could loop through all the user's uploaded files, sum up their file size and check if he is within quota, before you permit the user to upload a new file.
Or you could store how much capacity he has used up by adding/subtracting the file size when the user uploads/deletes a file from his account, and store this piece of data in the database.