/// <summary>
        /// This method is called automatically by response caching framework
        /// to provide caching directive for settings meta-data.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        protected ResponseCachingDirective GetSettingsMetadataCachingDirective(object request)
        {
            var settings = new ConfigurationStoreSettings();

            return(new ResponseCachingDirective(
                       settings.SettingsMetadataCachingEnabled,
                       TimeSpan.FromSeconds(settings.SettingsMetadataCachingTimeToLiveSeconds),
                       ResponseCachingSite.Client));
        }
        /// <summary>
        /// This method is called automatically by response caching framework
        /// to provide caching directive for configuration documents.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        protected ResponseCachingDirective GetDocumentCachingDirective(GetConfigurationDocumentRequest request)
        {
            // if the request is for ConfigurationStoreSettings, we cannot try to load
            // these settings to read the values, or we'll get into an infinite recursion
            // therefore, we assume ConfigurationStoreSettings are simply never cached.
            // a better solution would be to allow each settings group to specify its own
            // cacheability, and store this in the db with the settings meta-data
            // but this is not currently implemented
            if (request.DocumentKey.DocumentName == typeof(ConfigurationStoreSettings).FullName)
            {
                return(ResponseCachingDirective.DoNotCacheDirective);
            }

            var settings = new ConfigurationStoreSettings();

            return(new ResponseCachingDirective(
                       settings.ConfigurationCachingEnabled,
                       TimeSpan.FromSeconds(settings.ConfigurationCachingTimeToLiveSeconds),
                       ResponseCachingSite.Client));
        }
Esempio n. 3
0
		/// <summary>
		/// This method is called automatically by response caching framework
		/// to provide caching directive for configuration documents.
		/// </summary>
		/// <param name="request"></param>
		/// <returns></returns>
		protected ResponseCachingDirective GetDocumentCachingDirective(GetConfigurationDocumentRequest request)
		{
			// if the request is for ConfigurationStoreSettings, we cannot try to load 
			// these settings to read the values, or we'll get into an infinite recursion
			// therefore, we assume ConfigurationStoreSettings are simply never cached.
			// a better solution would be to allow each settings group to specify its own
			// cacheability, and store this in the db with the settings meta-data
			// but this is not currently implemented
			if (request.DocumentKey.DocumentName == typeof(ConfigurationStoreSettings).FullName)
			{
				return ResponseCachingDirective.DoNotCacheDirective;
			}

			var settings = new ConfigurationStoreSettings();
			return new ResponseCachingDirective(
				settings.ConfigurationCachingEnabled,
				TimeSpan.FromSeconds(settings.ConfigurationCachingTimeToLiveSeconds),
				ResponseCachingSite.Client);
		}
Esempio n. 4
0
		/// <summary>
		/// This method is called automatically by response caching framework
		/// to provide caching directive for settings meta-data.
		/// </summary>
		/// <param name="request"></param>
		/// <returns></returns>
		protected ResponseCachingDirective GetSettingsMetadataCachingDirective(object request)
		{
			var settings = new ConfigurationStoreSettings();
			return new ResponseCachingDirective(
				settings.SettingsMetadataCachingEnabled,
				TimeSpan.FromSeconds(settings.SettingsMetadataCachingTimeToLiveSeconds),
				ResponseCachingSite.Client);
		}