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
Update the cached value for the key when value set #86
Update the cached value for the key when value set #86
Conversation
@huacnlee Can you let me know if this looks good? Thanks. |
I don't know what your means, please give a example codes for this case. |
See added specs, @huacnlee. Thanks. |
@huacnlee Have you had a chance to look at my PR? |
An easier way to ensure consistency of cached settings (even during transactions, and in test) is to write the specific cache entry when an attribute is changed. |
The API is unchanged. All existing tests pass. Or do you mean that I should write a failing test that is fixed by the code change? |
d083fb1
to
3e812a2
Compare
If setting a cache value is called within a TX and then the value is accessed, then the old value is retrieved from the cache. The fix is to set the cached value for the var name immediately after calling save!.
3e812a2
to
5640654
Compare
This resolves some of the issue in my test suite, but not all of them. In particular, it appears that calls to |
@huacnlee Any word on this PR? |
Update the cached value for the key when value set
@huacnlee Any ETA on when you might push a new gem version? I've got a large production system that needs this change. Thanks! |
@justin808 version 0.5.4 |
@huacnlee Big thanks. Sorry I missed that! Have you considered tagging your versions. I do that with my gem: https://github.com/shakacode/react_on_rails/. See https://github.com/shakacode/react_on_rails/blob/master/docs%2Freleasing.md I use the gem "gem-release". |
If setting a cache value is called within a TX and then the value is
accessed, then the old value is retrieved from the cache.
The fix is to clear the cached value for the var name immediately after
calling save!. Note, it is still appropriate to clear cache values upon
commit due to race conditions.