コード例 #1
0
        /// <summary>
        /// Clears the managed property cache for a specified site collection.
        /// </summary>
        /// <param name="site">A site collection object.</param>
        public static void FlushCache(SPSite site)
        {
            CommonHelper.ConfirmNotNull(site, "site");
            SPSiteIdFactory.Destroy(site.ID);
            SearchServiceApplication searchApplication = GetSearchServiceApplication(site);

            if (searchApplication != null)
            {
                SearchApplicationIdFactory.Destroy(searchApplication.Id);
            }
        }
コード例 #2
0
ファイル: SiteConfig.cs プロジェクト: serenabenny/codeless
 /// <summary>
 /// Gets an instance of the current type <typeparamref name="T"/> which loads configuration from the specified site collection,
 /// and optionally refresh the cache.
 /// </summary>
 /// <param name="siteId">The GUID of a site collection.</param>
 /// <param name="forceRefresh">Whether to refresh the cache.</param>
 /// <returns>An instance of the current type <typeparamref name="T"/> which loads configuration from the given site collection.</returns>
 public static T Load(Guid siteId, bool forceRefresh)
 {
     if (forceRefresh)
     {
         InstanceFactory.Destroy(siteId);
     }
     try {
         // avoid config being cache without adding cache policy to HttpContext.Current.Cache
         if (HttpContext.Current == null)
         {
             T config;
             if (((IDictionary <Guid, T>)InstanceFactory).TryGetValue(siteId, out config))
             {
                 return(config);
             }
             return(LoadInternal(siteId));
         }
         return(InstanceFactory.GetInstance(siteId, LoadInternal));
     } catch (Exception ex) {
         Logger.Error(ex);
         return(new T());
     }
 }