Fixed bug in Azure cache providers (endless tenant restart).

This commit is contained in:
Daniel Stolt 2013-08-27 23:16:46 +02:00 committed by Sebastien Ros
parent c163d87902
commit 5bb2ff2f78
2 changed files with 24 additions and 8 deletions

View File

@ -19,14 +19,22 @@ namespace Orchard.Azure.Services.Caching.Database {
: base() {
// Create default configuration to local role-based cache when feature is enabled.
if (!shellSettings.Keys.Contains(Constants.DatabaseCacheHostIdentifierSettingName))
var doSave = false;
if (!shellSettings.Keys.Contains(Constants.DatabaseCacheHostIdentifierSettingName)) {
shellSettings[Constants.DatabaseCacheHostIdentifierSettingName] = "Orchard.Azure.Web";
if (!shellSettings.Keys.Contains(Constants.DatabaseCacheCacheNameSettingName))
doSave = true;
}
if (!shellSettings.Keys.Contains(Constants.DatabaseCacheCacheNameSettingName)) {
shellSettings[Constants.DatabaseCacheCacheNameSettingName] = "DatabaseCache";
if (!shellSettings.Keys.Contains(Constants.DatabaseCacheIsSharedCachingSettingName))
doSave = true;
}
if (!shellSettings.Keys.Contains(Constants.DatabaseCacheIsSharedCachingSettingName)) {
shellSettings[Constants.DatabaseCacheIsSharedCachingSettingName] = "false";
doSave = true;
}
shellSettingsManager.SaveSettings(shellSettings);
if (doSave)
shellSettingsManager.SaveSettings(shellSettings);
CacheHostIdentifier = shellSettings[Constants.DatabaseCacheHostIdentifierSettingName];
CacheName = shellSettings[Constants.DatabaseCacheCacheNameSettingName];

View File

@ -18,14 +18,22 @@ namespace Orchard.Azure.Services.Caching.Output {
: base() {
// Create default configuration to local role-based cache when feature is enabled.
if (!shellSettings.Keys.Contains(Constants.OutputCacheHostIdentifierSettingName))
var doSave = false;
if (!shellSettings.Keys.Contains(Constants.OutputCacheHostIdentifierSettingName)) {
shellSettings[Constants.OutputCacheHostIdentifierSettingName] = "Orchard.Azure.Web";
if (!shellSettings.Keys.Contains(Constants.OutputCacheCacheNameSettingName))
doSave = true;
}
if (!shellSettings.Keys.Contains(Constants.OutputCacheCacheNameSettingName)) {
shellSettings[Constants.OutputCacheCacheNameSettingName] = "OutputCache";
if (!shellSettings.Keys.Contains(Constants.OutputCacheIsSharedCachingSettingName))
doSave = true;
}
if (!shellSettings.Keys.Contains(Constants.OutputCacheIsSharedCachingSettingName)) {
shellSettings[Constants.OutputCacheIsSharedCachingSettingName] = "false";
doSave = true;
}
shellSettingsManager.SaveSettings(shellSettings);
if (doSave)
shellSettingsManager.SaveSettings(shellSettings);
var cacheHostIdentifier = shellSettings[Constants.OutputCacheHostIdentifierSettingName];
var cacheName = shellSettings[Constants.OutputCacheCacheNameSettingName];