зеркало из https://github.com/microsoft/2LCS.git
Clearing cache store and better error handling
Error handling while trying to clear the cache
This commit is contained in:
Родитель
23f0c23b73
Коммит
69d7abdfd6
|
@ -96,27 +96,30 @@ namespace LCS.Cache
|
|||
{
|
||||
Properties.Settings.Default.cachingEnabled = false;
|
||||
Properties.Settings.Default.keepCache = false;
|
||||
Properties.Settings.Default.cachingStore = "";
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
|
||||
public static void ClearCache()
|
||||
public static string ClearCache()
|
||||
{
|
||||
var tempFile = Properties.Settings.Default.cachingStore;
|
||||
|
||||
if (string.IsNullOrEmpty(tempFile))
|
||||
return;
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(tempFile);
|
||||
Properties.Settings.Default.cachingStore = "";
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
DisableCache();
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче