有效地设计一个简单的邮件客户端

时间:2009-03-25 18:12:50

标签: database architecture data-structures storage email-client

Requirement : JAVA desktop mail client which could connect to existing gmail,y! mail a/c & will allow receive/send mails, support offline view of mails, plus with more features as & when it comes. i am using Java Mail Api's

Underlying Mail Storage: I have decided to use HSQLDB with Hibernate. Email content can have attachments , HTML , so i decided to use LONGVARBINARY type to store the email Body & attachments.

Please let me know whether this approach is good & will it give me good performance when it comes to retrieval. Also give me some pointers on how to store java email objects in HSQLDB into LONGVARBINARY type & how to dereference it to get the actual data. ??

2)I am confused over this because , with Approach 1 , i will end up storing all mail contents somehow on my local disk to enable offline viewing. And imagine if i have 1GB of mails >

1 个答案:

答案 0 :(得分:1)

如果您使用基于文件的方法(这并不排除您使用数据库),您可以压缩和解压缩在不使用时用于持久性的文件。由于您将存储简单文本,因此压缩可能非常重要,如果您在智能选择的时间执行此操作,速度降低就不会那么糟糕。天哪,你甚至可以选择它。

这里要考虑的最重要的事情是搜索时间。您希望用户能够搜索什么?如果搜索很重要,我可能会使用数据库。我对问题的初步处理方法是将主题和标题信息(日期,发件人,收件人等)存储在单独的列中,然后将整个电子邮件对象序列化为二进制数据列(可能已压缩)。这会使全文搜索花费更长时间,但无论如何都是可以预期的,对吗?