예제 #1
0
        public void Save(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return;
            }

            Assertion.Assert(myPersistentCache != null, "myPersistentCache != null");
            myPersistentCache.Save(progress, myPersistentIdIndex, (writer, file, data) =>
                                   PsiCacheBuilder.Write(data, writer));
            myPersistentCache.Dispose();
            myPersistentCache = null;
        }
예제 #2
0
        public object Load(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return(null);
            }

            Assertion.Assert(myPersistentCache == null, "myPersistentCache == null");

            using (ReadLockCookie.Create())
            {
                myPersistentCache = new PsiPersistentCache <CachePair>(myShellLocks, VERSION, "PsiCache", myPsiConfiguration);
            }

            var data = new Dictionary <IPsiSourceFile, CachePair>();

            if (myPersistentCache.Load(progress, myPersistentIdIndex,
                                       (file, reader) =>
            {
                using (ReadLockCookie.Create())
                {
                    return(PsiCacheBuilder.Read(reader, file));
                }
            },
                                       (projectFile, psiSymbols) =>
            {
                if (projectFile != null)
                {
                    data[projectFile] = psiSymbols;
                }
            }) != LoadResult.OK)


            {
                // clear all...
                ((ICache)this).Release();
                return(null);
            }
            return(data);
        }