views:

37

answers:

2

I'm working on a side project right now for an email client. I'm using a library to handle the retrieval of the messages from the server. However, I have a question on caching.

I don't want to fetch the entire list of headers everytime I load the client. Ideally, what I'd like to do is cache them and then update the list with what is on the server.

What's the best way to go about this? Should I store all the header information (including the server's message ID #) in a database, load the headers from that DB. Then as a background task sync up with the server...

Or is there a better way?

+1  A: 

Look at the webmail sample of this open source project that use local caching:

http://mailsystem.codeplex.com/

If I remember well, he used a combination of local RFC822 plain text email storing with the message id as the filename and an index file with high level data.

Maybe the message itself where zipped to save disc space.

That's just a sample for the library, so don't expect code art there, but that's a start.

Pierre 303
A: 

First you need to get a list of all UIDs with flags (UID|FLAGS) for the current emails range. Then you promt for UID|FLAGS|HEADERS (for all new emails). Actually it takes some flexibility from your IMAP component. In case you face a problem, you may try MailBee.Net Objects or its Components.

AfterLogic