@@ -25,8 +25,8 @@ performance.
25
25
Boolean Available { get ; };
26
26
27
27
// 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 ]
30
30
String Model { get ; };
31
31
32
32
// ...
@@ -38,7 +38,7 @@ performance.
38
38
``` c# (but really MIDL3)
39
39
namespace Microsoft .Web .WebView2 .Core
40
40
{
41
- /// You can use the `memoizable ` attribute on a runtimeclass property
41
+ /// You can use the `cacheable ` attribute on a runtimeclass property
42
42
/// or runtimeclass method to indicate that the property value or
43
43
/// method return value can be cached.
44
44
///
@@ -52,20 +52,14 @@ namespace Microsoft.Web.WebView2.Core
52
52
/// You can apply it to a static method if when the method is called
53
53
/// with the same parameters it always returns the same value for the
54
54
/// 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.
61
55
///
62
56
/// When an object is projected into JavaScript via
63
57
/// `CoreWebView2.AddHostObjectToScript`, WebView2 will cache property values
64
58
/// marked with this attribute. This can potentially improve performance by
65
59
/// reducing the number of cross-process calls to obtain the latest value.
66
60
[attributeusage (target_property , target_method )]
67
- [attributename (" memoizable " )]
68
- attribute MemoizableAttribute
61
+ [attributename (" cacheable " )]
62
+ attribute CacheableAttribute
69
63
{
70
64
}
71
65
}
@@ -74,7 +68,7 @@ namespace Microsoft.Web.WebView2.Core
74
68
# Appendix
75
69
76
70
Names considered for the attribute:
77
- * ** Cacheable**
71
+ * ** Cacheable** : A familiar term also used by python that more closely matches this feature.
78
72
* ** ReadOnly** : Similar to C#'s readonly keyword which indicates a value won't change (once
79
73
initialized). But does not convey that the implementer cannot change the value.
80
74
* ** Immutable** : Similar to readonly
0 commit comments