@@ -149,7 +149,7 @@ public static int ElementCount(object? value)
149149 var cacheKey = $ "Lambda-Count-{ type . GetUniqueTypeName ( ) } ";
150150 var invoker = Instance . GetOrCreate ( cacheKey , entry =>
151151 {
152- entry . SetDynamicAssemblyPolicy ( type ) ;
152+ entry . SetSlidingExpirationByType ( type ) ;
153153 return LambdaExtensions . CountLambda ( type ) . Compile ( ) ;
154154 } ) ;
155155 ret = invoker ( value ) ;
@@ -271,10 +271,6 @@ private static JsonLocalizationOptions GetJsonLocalizationOption()
271271 /// <param name="includeParentCultures"></param>
272272 /// <returns></returns>
273273 public static IEnumerable < LocalizedString > GetTypeStringsFromResolve ( string typeName , bool includeParentCultures = true ) => Instance . Provider . GetRequiredService < ILocalizationResolve > ( ) . GetAllStringsByType ( typeName , includeParentCultures ) ;
274-
275- /// <summary>
276- /// </summary>
277- /// <returns></returns>
278274 #endregion
279275
280276 #region DisplayName
@@ -310,7 +306,7 @@ public static string GetDisplayName(Type modelType, string fieldName)
310306 dn = FindDisplayAttribute ( propertyInfo ) ;
311307 }
312308
313- entry . SetDynamicAssemblyPolicy ( modelType ) ;
309+ entry . SetSlidingExpirationByType ( modelType ) ;
314310
315311 return dn ;
316312 } ) ;
@@ -427,7 +423,7 @@ string FindDisplayTextByItemName(string itemName)
427423 dn = propertyInfo . GetCustomAttribute < RangeAttribute > ( true ) ;
428424 }
429425
430- entry . SetDynamicAssemblyPolicy ( modelType ) ;
426+ entry . SetSlidingExpirationByType ( modelType ) ;
431427 return dn ;
432428 } ) ;
433429 }
@@ -458,7 +454,7 @@ string FindDisplayTextByItemName(string itemName)
458454 }
459455 }
460456
461- entry . SetDynamicAssemblyPolicy ( modelType ) ;
457+ entry . SetSlidingExpirationByType ( modelType ) ;
462458 }
463459 return ret ;
464460 } ) ;
@@ -482,7 +478,7 @@ public static bool TryGetProperty(Type modelType, string fieldName, [NotNullWhen
482478
483479 var pi = props . FirstOrDefault ( p => p . Name == fieldName ) ;
484480
485- entry . SetDynamicAssemblyPolicy ( modelType ) ;
481+ entry . SetSlidingExpirationByType ( modelType ) ;
486482
487483 return pi ;
488484 } ) ;
@@ -506,7 +502,7 @@ TResult GetValue()
506502 var cacheKey = ( $ "Lambda-Get-{ type . GetUniqueTypeName ( ) } ", typeof ( TModel ) , fieldName , typeof ( TResult ) ) ;
507503 var invoker = Instance . GetOrCreate ( cacheKey , entry =>
508504 {
509- entry . SetDynamicAssemblyPolicy ( type ) ;
505+ entry . SetSlidingExpirationByType ( type ) ;
510506 return LambdaExtensions . GetPropertyValueLambda < TModel , TResult > ( model , fieldName ) . Compile ( ) ;
511507 } ) ! ;
512508 return invoker ( model ) ;
@@ -535,7 +531,7 @@ void SetValue()
535531 var cacheKey = ( $ "Lambda-Set-{ type . GetUniqueTypeName ( ) } ", typeof ( TModel ) , fieldName , typeof ( TValue ) ) ;
536532 var invoker = Instance . GetOrCreate ( cacheKey , entry =>
537533 {
538- entry . SetDynamicAssemblyPolicy ( type ) ;
534+ entry . SetSlidingExpirationByType ( type ) ;
539535 return LambdaExtensions . SetPropertyValueLambda < TModel , TValue > ( model , fieldName ) . Compile ( ) ;
540536 } ) ! ;
541537 invoker ( model , value ) ;
@@ -559,7 +555,7 @@ void SetValue()
559555 var cacheKey = ( $ "Lambda-GetKeyValue-{ type . GetUniqueTypeName ( ) } -{ customAttribute ? . GetUniqueTypeName ( ) } ", typeof ( TModel ) ) ;
560556 var invoker = Instance . GetOrCreate ( cacheKey , entry =>
561557 {
562- entry . SetDynamicAssemblyPolicy ( type ) ;
558+ entry . SetSlidingExpirationByType ( type ) ;
563559
564560 return LambdaExtensions . GetKeyValue < TModel , TValue > ( customAttribute ) . Compile ( ) ;
565561 } ) ! ;
@@ -575,7 +571,7 @@ public static Func<IEnumerable<T>, string, SortOrder, IEnumerable<T>> GetSortFun
575571 var cacheKey = $ "Lambda-{ nameof ( LambdaExtensions . GetSortLambda ) } -{ typeof ( T ) . GetUniqueTypeName ( ) } ";
576572 return Instance . GetOrCreate ( cacheKey , entry =>
577573 {
578- entry . SetDynamicAssemblyPolicy ( typeof ( T ) ) ;
574+ entry . SetSlidingExpirationByType ( typeof ( T ) ) ;
579575 return LambdaExtensions . GetSortLambda < T > ( ) . Compile ( ) ;
580576 } ) ! ;
581577 }
@@ -585,7 +581,7 @@ public static Func<IEnumerable<T>, List<string>, IEnumerable<T>> GetSortListFunc
585581 var cacheKey = $ "Lambda-{ nameof ( LambdaExtensions . GetSortListLambda ) } -{ typeof ( T ) . GetUniqueTypeName ( ) } ";
586582 return Instance . GetOrCreate ( cacheKey , entry =>
587583 {
588- entry . SetDynamicAssemblyPolicy ( typeof ( T ) ) ;
584+ entry . SetSlidingExpirationByType ( typeof ( T ) ) ;
589585 return LambdaExtensions . GetSortListLambda < T > ( ) . Compile ( ) ;
590586 } ) ! ;
591587 }
@@ -605,7 +601,7 @@ public static Func<IEnumerable<T>, List<string>, IEnumerable<T>> GetSortListFunc
605601 var convert = Expression . Convert ( para_exp , typeof ( List < > ) . MakeGenericType ( type ) ) ;
606602 var body = Expression . Call ( method , convert ) ;
607603
608- entry . SetDynamicAssemblyPolicy ( type ) ;
604+ entry . SetSlidingExpirationByType ( type ) ;
609605 return Expression . Lambda < Func < object , IEnumerable < string ? > > > ( body , para_exp ) . Compile ( ) ;
610606 } ) ! ;
611607 }
@@ -627,7 +623,7 @@ public static Func<IEnumerable<T>, List<string>, IEnumerable<T>> GetSortListFunc
627623 var cacheKey = $ "Lambda-{ nameof ( GetOnValueChangedInvoke ) } -{ typeof ( TModel ) . GetUniqueTypeName ( ) } -{ fieldType . GetUniqueTypeName ( ) } ";
628624 return Instance . GetOrCreate ( cacheKey , entry =>
629625 {
630- entry . SetDynamicAssemblyPolicy ( fieldType ) ;
626+ entry . SetSlidingExpirationByType ( fieldType ) ;
631627 return Utility . CreateOnValueChanged < TModel > ( fieldType ) . Compile ( ) ;
632628 } ) ! ;
633629 }
@@ -639,7 +635,7 @@ public static Func<IEnumerable<T>, List<string>, IEnumerable<T>> GetSortListFunc
639635 var cacheKey = $ "{ nameof ( GetFormatInvoker ) } -{ type . GetUniqueTypeName ( ) } ";
640636 return Instance . GetOrCreate ( cacheKey , entry =>
641637 {
642- entry . SetDynamicAssemblyPolicy ( type ) ;
638+ entry . SetSlidingExpirationByType ( type ) ;
643639 return GetFormatLambda ( type ) . Compile ( ) ;
644640 } ) ! ;
645641
@@ -681,7 +677,7 @@ public static Func<IEnumerable<T>, List<string>, IEnumerable<T>> GetSortListFunc
681677 var cacheKey = $ "{ nameof ( GetFormatProviderInvoker ) } -{ type . GetUniqueTypeName ( ) } ";
682678 return Instance . GetOrCreate ( cacheKey , entry =>
683679 {
684- entry . SetDynamicAssemblyPolicy ( type ) ;
680+ entry . SetSlidingExpirationByType ( type ) ;
685681 return GetFormatProviderLambda ( type ) . Compile ( ) ;
686682 } ) ! ;
687683
@@ -712,7 +708,7 @@ public static object GetFormatterInvoker(Type type, Func<object, Task<string?>>
712708 var cacheKey = $ "{ nameof ( GetFormatterInvoker ) } -{ type . GetUniqueTypeName ( ) } ";
713709 var invoker = Instance . GetOrCreate ( cacheKey , entry =>
714710 {
715- entry . SetDynamicAssemblyPolicy ( type ) ;
711+ entry . SetSlidingExpirationByType ( type ) ;
716712 return GetFormatterInvokerLambda ( type ) . Compile ( ) ;
717713 } ) ;
718714 return invoker ( formatter ) ;
@@ -741,7 +737,7 @@ public static List<PropertyInfo> GetRuntimeProperties(Type type)
741737 var cacheKey = $ "{ nameof ( GetRuntimeProperties ) } -{ type . GetUniqueTypeName ( ) } ";
742738 return Instance . GetOrCreate ( cacheKey , entry =>
743739 {
744- entry . SetDynamicAssemblyPolicy ( type ) ;
740+ entry . SetSlidingExpirationByType ( type ) ;
745741 return type . GetRuntimeProperties ( ) . ToList ( ) ;
746742 } ) ;
747743 }
@@ -756,7 +752,7 @@ public static List<FieldInfo> GetRuntimeFields(Type type)
756752 var cacheKey = $ "{ nameof ( GetRuntimeFields ) } -{ type . GetUniqueTypeName ( ) } ";
757753 return Instance . GetOrCreate ( cacheKey , entry =>
758754 {
759- entry . SetDynamicAssemblyPolicy ( type ) ;
755+ entry . SetSlidingExpirationByType ( type ) ;
760756 return type . GetRuntimeFields ( ) . ToList ( ) ;
761757 } ) ! ;
762758 }
0 commit comments