ZeroInstall.Services.Solvers.SelectionCandidateProvider.BuildCacheChecker C# (CSharp) Method

BuildCacheChecker() private static method

Returns a predicate that checks whether a given Implementation is cached in the store (or has an ImplementationBase.LocalPath or ExternalImplementation.IsInstalled).
private static BuildCacheChecker ( IStore store ) : Predicate
store IStore
return Predicate
        private static Predicate<Implementation> BuildCacheChecker(IStore store)
        {
            var storeContainsCache = new TransparentCache<ManifestDigest, bool>(store.Contains);

            return implementation =>
            {
                if (!string.IsNullOrEmpty(implementation.LocalPath)) return true;

                var externalImplementation = implementation as ExternalImplementation;
                if (externalImplementation != null) return externalImplementation.IsInstalled;

                return storeContainsCache[implementation.ManifestDigest];
            };
        }
        #endregion