Пример #1
0
        public static void ClearCache(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            var cacheFile = Path.Combine(CacheDirectory, GetFileNameFromUrl(url));

            if (File.Exists(cacheFile))
            {
                logger.Debug($"Removing {url} from file cache: {cacheFile}");
                FileSystem.DeleteFileSafe(cacheFile);
            }
        }
Пример #2
0
        public static void ClearCache(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            lock (cacheLock)
            {
                var cacheFile = Path.Combine(CacheDirectory, GetFileNameFromUrl(url));
                if (File.Exists(cacheFile))
                {
                    logger.Debug($"Removing {url} from file cache: {cacheFile}");
                    try
                    {
                        FileSystem.DeleteFileSafe(cacheFile);
                    }
                    catch (Exception e) when(!PlayniteEnvironment.ThrowAllErrors)
                    {
                        logger.Error(e, $"Failed to remove {url} from cache.");
                    }
                }
            }
        }