@@ -25,8 +25,8 @@ performance.
2525 Boolean Available { get ; };
2626
2727 // This property has one value for the lifetime of the object so we mark it
28- // memoizable to improve runtime performance.
29- [memoizable ]
28+ // cacheable to improve runtime performance.
29+ [cacheable ]
3030 String Model { get ; };
3131
3232 // ...
@@ -38,7 +38,7 @@ performance.
3838``` c# (but really MIDL3)
3939namespace Microsoft .Web .WebView2 .Core
4040{
41- /// You can use the `memoizable ` attribute on a runtimeclass property
41+ /// You can use the `cacheable ` attribute on a runtimeclass property
4242 /// or runtimeclass method to indicate that the property value or
4343 /// method return value can be cached.
4444 ///
@@ -52,20 +52,14 @@ namespace Microsoft.Web.WebView2.Core
5252 /// You can apply it to a static method if when the method is called
5353 /// with the same parameters it always returns the same value for the
5454 /// lifetime of the process.
55- /// If the property type or the method return type is an object, the property
56- /// value must be the same object by reference or the method must return the
57- /// same object by reference in order to be memoizable. Merely returning an
58- /// equivalent but different object is not sufficient to be memoizable.
59- /// Similarly, a method call having the same parameters means the same object
60- /// references and not equivalent but different objects.
6155 ///
6256 /// When an object is projected into JavaScript via
6357 /// `CoreWebView2.AddHostObjectToScript`, WebView2 will cache property values
6458 /// marked with this attribute. This can potentially improve performance by
6559 /// reducing the number of cross-process calls to obtain the latest value.
6660 [attributeusage (target_property , target_method )]
67- [attributename (" memoizable " )]
68- attribute MemoizableAttribute
61+ [attributename (" cacheable " )]
62+ attribute CacheableAttribute
6963 {
7064 }
7165}
@@ -74,7 +68,7 @@ namespace Microsoft.Web.WebView2.Core
7468# Appendix
7569
7670Names considered for the attribute:
77- * ** Cacheable**
71+ * ** Cacheable** : A familiar term also used by python that more closely matches this feature.
7872 * ** ReadOnly** : Similar to C#'s readonly keyword which indicates a value won't change (once
7973 initialized). But does not convey that the implementer cannot change the value.
8074 * ** Immutable** : Similar to readonly
0 commit comments