Exemple #1
0
 private void DataTypeCacheRefresher_Updated(DataTypeCacheRefresher sender, CacheRefresherEventArgs e)
 {
     if (e.MessageType == MessageType.RefreshByJson)
     {
         var payload = JsonConvert.DeserializeObject <JsonPayload[]>((string)e.MessageObject);
         if (payload != null)
         {
             foreach (var item in payload)
             {
                 NestedContentHelper.ClearCache(item.Id);
             }
         }
     }
 }
Exemple #2
0
        public override void Refresh(string jsonPayload)
        {
            var payloads = DeserializeFromJsonPayload(jsonPayload);

            //we need to clear the ContentType runtime cache since that is what caches the
            // db data type to store the value against and anytime a datatype changes, this also might change
            // we basically need to clear all sorts of runtime caches here because so many things depend upon a data type

            ClearAllIsolatedCacheByEntityType <IContent>();
            ClearAllIsolatedCacheByEntityType <IContentType>();
            ClearAllIsolatedCacheByEntityType <IMedia>();
            ClearAllIsolatedCacheByEntityType <IMediaType>();
            ClearAllIsolatedCacheByEntityType <IMember>();
            ClearAllIsolatedCacheByEntityType <IMemberType>();

            var dataTypeCache = ApplicationContext.Current.ApplicationCache.IsolatedRuntimeCache.GetCache <IDataTypeDefinition>();

            foreach (var payload in payloads)
            {
                //clears the prevalue cache
                if (dataTypeCache)
                {
                    dataTypeCache.Result.ClearCacheByKeySearch(string.Format("{0}_{1}", CacheKeys.DataTypePreValuesCacheKey, payload.Id));
                }

                ApplicationContext.Current.Services.IdkMap.ClearCache(payload.Id);
                PublishedContentType.ClearDataType(payload.Id);
                NestedContentHelper.ClearCache(payload.Id);
            }

            TagsValueConverter.ClearCaches();
            LegacyMediaPickerPropertyConverter.ClearCaches();
            SliderValueConverter.ClearCaches();
            MediaPickerPropertyConverter.ClearCaches();
            MultiUrlPickerPropertyConverter.ClearCaches();


            base.Refresh(jsonPayload);
        }