Skip to content

Commit

Permalink
refactor(cache): option for cache rendered content (#3963)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Dec 16, 2019
1 parent 457fcfc commit 499c2b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/hexo/default_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ module.exports = {
pagination_dir: 'page',
// Extensions
theme: 'landscape',
server: {
cache: false
},
// Deployment
deploy: {},

Expand Down
6 changes: 5 additions & 1 deletion lib/hexo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ class Hexo {

watch(callback) {
let useCache = false;
if (this.env.cmd.startsWith('s')) {
const { cache } = Object.assign({
cache: false
}, this.config.server);

if (this.env.cmd.startsWith('s') && cache) {
// enable cache when run hexo server
useCache = true;
}
Expand Down

0 comments on commit 499c2b6

Please sign in to comment.