Skip to content

Commit 65e0e45

Browse files
committed
Explain caching better in Readme.md
1 parent 9643e8b commit 65e0e45

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Readme.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,8 @@ cons[name]('views/page.html', { user: 'tobi' }, function(err, html){
7272
## Caching
7373

7474
To enable caching simply pass `{ cache: true }`. Engines _may_ use this option to cache things reading the file contents, compiled `Function`s etc. Engines which do _not_ support this may simply ignore it. All engines that consolidate.js implements I/O for will cache the file contents, ideal for production environments.
75-
76-
```js
77-
var cons = require('consolidate');
78-
cons.swig('views/page.html', { user: 'tobi' }, function(err, html){
79-
if (err) throw err;
80-
console.log(html);
81-
});
82-
```
75+
When using consolidate directly: `cons.swig('views/page.html', { user: 'tobi', cache:true },callback);`
76+
Using Express 3 or higher: `app.locals.cache = true` or set NODE_ENV to 'production' and Express will do this for you.
8377

8478
## Express 3.x example
8579

0 commit comments

Comments
 (0)