Cache articles in memory for speed

This commit is contained in:
Tanner
2019-10-18 21:26:22 +00:00
parent b09599aa5f
commit 5de8631115
4 changed files with 33 additions and 6 deletions
+6 -1
View File
@@ -8,8 +8,13 @@ class Article extends React.Component {
constructor(props) {
super(props);
const id = this.props.match.params.id;
const cache = this.props.cache;
if (id in cache) console.log('cache hit');
this.state = {
story: false,
story: cache[id] || false,
error: false,
};
}