且构网

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

我应该动态重新创建PDF,而不是将其存储在数据库或文件系统?

更新时间:2023-01-22 11:45:18

我保存它关闭的原因有两个。

I'd store it off for two reasons

1)如果你改变你如何生成PDF,你可能不希望历史文物改变。如果您生成它们每一次,他们要么会改变,或者你需要保持兼容性code生成旧式的记载。

1) If you ever change how you generate the PDF, you probably don't want historical items to change. If you generate them every time, either they will change or you need to keep compatibility code to generate "old-style" records

2)磁盘空间很便宜。用户的耐心是没有的。除非你真的pressed存储或拔出存储比生成PDF困难,善待你的用户并存储了。

2) Disk space is cheap. User's patience isn't. Unless you're really pressed for storage or pulling out of storage is harder than generating the PDF, be kind to your users and store it off.

显然,如果你从稀疏数据集创建数以千计的一个小时,你可能没有储存。但是,如果你有空间,我会投给使用

Obviously if you create thousands of these an hour from a sparse dataset, you may not have the storage. But if you have the space, I'd vote for "use it"