I have this Vue.js code:
new Vue({
data:{
myValue:\'x\',
myOtherValue:\'y\'
},
computed: {
myComputed: myFunction(){
ret
It's the reactivity system of Vue.js, not a caching system.
The data in a component will be convert to getters and setters. When you access a value via a getter, the getter will add it to the dependencies, and when you modify the value via a setter, the setter will notify everyone who depends on the value.
Here is the source code, all the magic happens in this function: https://github.com/vuejs/vue/blob/dev/src/core/observer/index.js#L131