-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement @glimmer/tracking/primatives/cache
(see [emberjs/rfcs#615](https://github.com/emberjs/rfcs/blob/master/text/0615-autotracking-memoization.md) for details)
#1090
Conversation
991e18b
to
cfccc14
Compare
@pzuraq - Looks like this needs a rebase |
cfccc14
to
d1064b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make an exported interface CacheHandle<TResult = unknown> { __isCacheBrand: TResult }
that createCache casts Cache to and getValue and isConst take.
The Cache doesn't implement this, you just cache at boundaries (you cast Cache as unknown then the CacheHandle in createCache and the CacheHandle to unknown to Cache in getValue and isConst).
This lets the implementation change independent of type consumers.
df5733d
to
d944a43
Compare
d944a43
to
a7d181c
Compare
a7d181c
to
01acfbe
Compare
Adds the cache API specified in [RFC 615](https://github.com/emberjs/rfcs/blob/master/text/0615-autotracking-memoization.md). There were a few minor refactors in addition to this: - Moved `trackedData` into a separate module, since the `tracking` module was getting pretty big. - Renamed `isConst` to `isConstTagged`, since there is a naming conflict with the new `isConst` function. Given `isConstTagged` will be removed soon and is not generally much used outside of the VM, I thought it was better to prioritize the new API getting this name. - Rewrote the `memoizeTracked` implementation on top of the cache APIs. One thing worth noting is that in order to support the API `memoizeTracked` had before, `getValue` also needed to be able to accept and pass on args. This is something we'll wrap to hide when we expose this publicly in Ember/Glimmer for the time being, since that was a capability that was not added in the RFC.
01acfbe
to
790508c
Compare
cache
api@glimmer/tracking/primatives/cache
(see [emberjs/rfcs#615](https://github.com/emberjs/rfcs/blob/master/text/0615-autotracking-memoization.md) for details)
Adds the cache API specified in RFC 615.
There were a few minor refactors in addition to this:
Moved
trackedData
into a separate module, since thetracking
module was getting pretty big.
Renamed
isConst
toisConstTagged
, since there is a naming conflictwith the new
isConst
function. GivenisConstTagged
will be removedsoon and is not generally much used outside of the VM, I thought it
was better to prioritize the new API getting this name.
Rewrote the
memoizeTracked
implementation on top of the cache APIs.One thing worth noting is that in order to support the API
memoizeTracked
had before,getValue
also needed to be able toaccept and pass on args. This is something we'll wrap to hide when we
expose this publicly in Ember/Glimmer for the time being, since that
was a capability that was not added in the RFC.