コード例 #1
0
 internal static void Save(TopicHashCache cache, IXSOFactory xsoFactory, IMailboxSession session)
 {
     try
     {
         using (IFolder folder = xsoFactory.BindToFolder(session, DefaultFolderType.Inbox, new PropertyDefinition[]
         {
             FolderSchema.ConversationTopicHashEntries
         }))
         {
             using (MemoryStream memoryStream = new MemoryStream(cache.EstimatedSize))
             {
                 cache.Serialize(memoryStream);
                 folder[FolderSchema.ConversationTopicHashEntries] = memoryStream.ToArray();
                 folder.Save();
             }
         }
     }
     catch (IOException arg)
     {
         ExTraceGlobals.StorageTracer.TraceDebug <IOException>(0L, "TopicHashCache::Save. Encountered the following exception. Exception = {0}.", arg);
     }
     catch (StorageTransientException arg2)
     {
         ExTraceGlobals.StorageTracer.TraceDebug <StorageTransientException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg2);
     }
     catch (StoragePermanentException arg3)
     {
         ExTraceGlobals.StorageTracer.TraceDebug <StoragePermanentException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg3);
     }
 }
コード例 #2
0
        internal static TopicHashCache Load(IXSOFactory xsoFactory, IMailboxSession session, int cacheSize)
        {
            TopicHashCache topicHashCache = new TopicHashCache(cacheSize);

            try
            {
                byte[] array = null;
                using (IFolder folder = xsoFactory.BindToFolder(session, DefaultFolderType.Inbox, new PropertyDefinition[]
                {
                    FolderSchema.ConversationTopicHashEntries
                }))
                {
                    array = (folder.TryGetProperty(FolderSchema.ConversationTopicHashEntries) as byte[]);
                }
                if (array != null)
                {
                    using (MemoryStream memoryStream = new MemoryStream(array))
                    {
                        topicHashCache.Deserialize(memoryStream);
                    }
                }
            }
            catch (IOException arg)
            {
                ExTraceGlobals.StorageTracer.TraceDebug <IOException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg);
                topicHashCache = new TopicHashCache(cacheSize);
            }
            catch (StorageTransientException arg2)
            {
                ExTraceGlobals.StorageTracer.TraceDebug <StorageTransientException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg2);
                topicHashCache = new TopicHashCache(cacheSize);
            }
            catch (StoragePermanentException arg3)
            {
                ExTraceGlobals.StorageTracer.TraceDebug <StoragePermanentException>(0L, "TopicHashCache::Load. Encountered the following exception. Exception = {0}.", arg3);
                topicHashCache = new TopicHashCache(cacheSize);
            }
            return(topicHashCache);
        }
コード例 #3
0
 internal static TopicHashCache Load(IXSOFactory xsoFactory, IMailboxSession session)
 {
     return(TopicHashCache.Load(xsoFactory, session, 50));
 }