-
Notifications
You must be signed in to change notification settings - Fork 800
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
Stats: Use Transient API to Improve Cache Performance #13147
Conversation
Rather than storing every cached stats item in one big option, store each separately in their own transient. Moving to transients also means we don't need to worry about expiring the cache ourselves: core will take care of it.
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: August 6, 2019. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
* Add initial changelog / testing list changes for 7.6 * Update stable tag to 7.5.3 * changelog: add #12957 * Changelog: add #12932 * Changelog: add #12867 * Changelog: add #12823 * changelog: add #12969 * changelog: add #13012 * changelog: add #12974 * Changelog: add #13059 * Changelog: add #13079 * Changelog: add #12924 * changelog: add #12954 * Changelog: add #12959 * Changelog: add #12977 * Changelog: add #12830 * Changelog: add #12926 * Changelog: add #12958 * Changelog: add #12999 * Changelog: add #13077 * Changelog: add #13083 * Changelog: add #13087 * Changelog: add #13110 * Changelog: add #13116 * Changelog: add #13117 * Changelog: add #12821 * Changelog: add #13120 * changelog: add #13139 * Changelog: add #13143 * Changelog: add #13147 * Testing list: add section about sync
* Add initial changelog / testing list changes for 7.6 * Update stable tag to 7.5.3 * changelog: add #12957 * Changelog: add #12932 * Changelog: add #12867 * Changelog: add #12823 * changelog: add #12969 * changelog: add #13012 * changelog: add #12974 * Changelog: add #13059 * Changelog: add #13079 * Changelog: add #12924 * changelog: add #12954 * Changelog: add #12959 * Changelog: add #12977 * Changelog: add #12830 * Changelog: add #12926 * Changelog: add #12958 * Changelog: add #12999 * Changelog: add #13077 * Changelog: add #13083 * Changelog: add #13087 * Changelog: add #13110 * Changelog: add #13116 * Changelog: add #13117 * Changelog: add #12821 * Changelog: add #13120 * changelog: add #13139 * Changelog: add #13143 * Changelog: add #13147 * Testing list: add section about sync
Fixes #13121
Changes proposed in this Pull Request:
Rather than storing every cached stats item in one big option, store each separately in their own transient.
Moving to transients also means we don't need to worry about expiring the cache ourselves: Core will take care of it.
Bonus: Storing JSON serialized data is significantly more space efficient for our use case than storing data serialized by
serialize()
. (We're actually doing a bit of both in this PR, but still getting most of the savings.)Is this a new feature or does it add/remove features to an existing part of Jetpack?
Bug fix.
Testing instructions:
git checkout master
wp option get jetpack_restapi_stats_cache
- see a bunch of stuff.git checkout fix/13121-use-transients-for-stats-cache
JETPACK__VERSION
.wp option get jetpack_restapi_stats_cache
- see that the option doesn't exist.wp transient list --search='jetpack_restapi_stats_cache_*'
- see the data in the transient(s). Note the expiration.wp transient list --search='jetpack_restapi_stats_cache_*'
- see the data still in the transient(s). See that the expiration has not changed.JETPACK__VERSION
.Proposed changelog entry for your changes:
Improve Stats Cache performance by switching from the WordPress Options API to the WordPress Transient API.