Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable cache in views? #542

Closed
kratkar opened this issue Mar 1, 2011 · 9 comments
Closed

How to disable cache in views? #542

kratkar opened this issue Mar 1, 2011 · 9 comments

Comments

@kratkar
Copy link

kratkar commented Mar 1, 2011

No description provided.

@tj
Copy link
Member

tj commented Mar 1, 2011

why do you want to? they only cache in production, and the contents do not cache, just the compiled template function

@kratkar
Copy link
Author

kratkar commented Mar 1, 2011

In templates of authorization and registration. At wrong fillings of fields of the form, it is necessary to deduce that they have filled. Also it should be dependent on parameter options func render. And at post requests it is necessary to not caching (as, for example, it is made in nginx)

@tj
Copy link
Member

tj commented Mar 1, 2011

like i said, the contents are not cached

@kratkar
Copy link
Author

kratkar commented Mar 1, 2011

cached in devlopment - run node app.js
I fill the form I send, I pass simply on link - it is filled. restart app - ok

@kratkar
Copy link
Author

kratkar commented Mar 1, 2011

At get request (after post) the cache undertakes with last post request

@tj
Copy link
Member

tj commented Mar 1, 2011

it could be your browser filling the fields, I assure you express does not cache contents of anything

@kratkar
Copy link
Author

kratkar commented Mar 1, 2011

ok. I made a mistake trying to make the default value (view options) for each template. That got the bug.
But how to do this(default value view options)?
Is in app.js:


app.configure(function(){
...
app.set('view options', {
    locals: {
      lang: 'ru',
      head: {
        title: 'title',
        description: 'description',
        author: 'author'
      }
   },
   layout: 'layouts/default'
 });
...
})
app.get('/auth', require('./exports/routeAuth').get)

./exports/routeAuth:


exports.get = function(req, res, next){
  res.render('auth', {email: 'email', name: 'name'})
}

Run. Error - lang is not defined.

@tj
Copy link
Member

tj commented Mar 1, 2011

ah I see, I'm not sure if we are currently merging locals from the view options if not we should but im willing to bet we are not

@tj
Copy link
Member

tj commented Mar 1, 2011

added this issue #543

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants