Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

Expressでtwigのキャッシュ設定が効かない

More than 1 year has passed since last update.

Expressでテンプレートのキャッシュを切りたい場合、app.set('view cache', false)としてやればよいが、twigではなぜか設定が反映されない。
調べてみると、どうやらtwig.cache(false)で別途設定する必要があるよう。

Disable view cache in express · Issue #312 · twigjs/twig.js · GitHub

var twig = require('twig');

app.set('view engine', 'twig');
app.set('views', viewsDir);
app.set('cache', false);

// disable twig cache
twig.cache(false);
hal9188
yahoo-japan-corp
Yahoo! JAPAN を運営しています。
https://www.yahoo.co.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away