diff options
author | Kali Kaneko <kali@leap.se> | 2014-02-17 12:18:41 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-02-17 20:42:23 -0400 |
commit | 0e471dbe8806bcc0fccf97667628b86925bcfd1d (patch) | |
tree | 8050786c1f670ab15cf6fdda8fad3f237ef32d86 /mail | |
parent | 81a646792219f33e1331aa179dc6032b32026238 (diff) |
cache uidvalidity
Diffstat (limited to 'mail')
-rw-r--r-- | mail/src/leap/mail/imap/mailbox.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mail/src/leap/mail/imap/mailbox.py b/mail/src/leap/mail/imap/mailbox.py index 57505f0f..6513db94 100644 --- a/mail/src/leap/mail/imap/mailbox.py +++ b/mail/src/leap/mail/imap/mailbox.py @@ -149,6 +149,8 @@ class SoledadMailbox(WithMsgFields, MBoxParser): self.messages = MessageCollection( mbox=mbox, soledad=self._soledad, memstore=self._memstore) + self._uidvalidity = None + # XXX careful with this get/set (it would be # hitting db unconditionally, move to memstore too) # Now it's returning a fixed amount of flags from mem @@ -339,8 +341,10 @@ class SoledadMailbox(WithMsgFields, MBoxParser): :return: unique validity identifier :rtype: int """ - mbox = self._get_mbox_doc() - return mbox.content.get(self.CREATED_KEY, 1) + if self._uidvalidity is None: + mbox = self._get_mbox_doc() + self._uidvalidity = mbox.content.get(self.CREATED_KEY, 1) + return self._uidvalidity def getUID(self, message): """ |