We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I defined a mysql model
{ id: {type: 'number'} some_object: {type:'text'} }, { hooks: { beforeSave: function (next){ this.some_object = JSON.stringify(this.some_object); return next(); }, afterLoad: function (next){ this.some_object = JSON.parse(this.some_object); return next(); } } }
Every time I use it, it want the field is already a JSON obj and text in db
Seems that there is a caching mechanism:
afterLoad
beforeSave
how about calling the afterLoad hook no matter it is in cache or not?
The text was updated successfully, but these errors were encountered:
The cache is not a cache but an implementation of the identity pattern. It will not improve performance, so you might as well not use it.
Sorry, something went wrong.
@dxg How can I call afterLoad every time I use the model.get
model.get
No branches or pull requests
I defined a mysql model
Every time I use it, it want the field is already a JSON obj and text in db
Seems that there is a caching mechanism:
I found that the
afterLoad
will not be called when I do some search thingthe
beforeSave
hook is called at last, so the some_object in memory is text not objhow about calling the
afterLoad
hook no matter it is in cache or not?The text was updated successfully, but these errors were encountered: