我应该动态重新创建PDF,而不是将其存储在数据库或文件系统? [英] Should I dynamically recreate a PDF, rather than store it in either the database or the filesystem?

查看:133
本文介绍了我应该动态重新创建PDF,而不是将其存储在数据库或文件系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要客户能够下载的已发送给他们的信件的PDF文件。

I need customers to be able to download PDFs of letters that have been sent to them.

我看了一下数据库VS的文档或图像文件系统存储线程,它听起来像的共识是,任何东西不仅仅是几张图片越多,文件系统是要走的路。

I have read the threads about database vs filesystem storage of documents or images, and it does sound like the consensus is that, for anything more than just a few images, filesystem is the way to go.

我想知道的:将一个合理的选择是只存储在数据库中的信的细节,并重新'飞'当要求

What I want to know: would a reasonable alternative be to just store the letter details in the database, and recreate the PDF 'on the fly' when it is requested?

是这种方法优于或劣于从文件系统获取的PDF?

Is that approach superior or inferior to fetching the PDF from the filesystem?

推荐答案

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

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"

这篇关于我应该动态重新创建PDF,而不是将其存储在数据库或文件系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆