Cache articles in memory for speed

This commit is contained in:
2019-10-18 21:26:22 +00:00
parent 6764bf0d6d
commit 187c6b8110
4 changed files with 33 additions and 6 deletions

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,
};
}