-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add caching for VideoPress functions with meta queries (#14803)
* Add caching for VideoPress functions that call WP_Query These involve meta queries, so it'd be good to have some kind of caching. * Change the since tag to 8.4.0 As Jeremy mentioned, 8.3.0 now has a code freeze. * Revert changes to videopress_get_attachment_id_by_url() As Dero mentioned, it looks like this isn't used in Jetpack. * Deprecate videopress_get_attachment_id_by_url() As Jeremy mentioned, this should give third-party developers a chance to change to something else. * Store the videopress ID in a transient if no persistent object caching Also, store the full WP_Post in the cache, if it is available. * Remove needless helper method There is actually an existing function that does the same thing. * Add a new function, using Leo's suggestion Add video_get_post_id_by_guid(), and a unit test for it. * Move the new function's test lower in the file To correspond to its position in utility-functions.php. * Set the transient expiration to an hour Following Leo's snippet, this should have an expiration. * Add a see tag, correct DocBlock summary The see tag points to a possible replacement. Also, the DocBlock summary references the wrong function. * Change prefix of new function from video_ to videopress_ Also change the transient cache key. Also, simply return the post, instead of accessing the ->ID property. * Add since tags to new functions videopress_get_post_id_by_guid() now has a @SInCE tag, in addition to other dataProviders * Remove needless comment This applied when it was part of video_get_post_by_guid(), but not to the new function it's in. * Rename function to keep consistency Co-authored-by: leogermani <[email protected]>
- Loading branch information
1 parent
47e4399
commit f98f1e1
Showing
3 changed files
with
250 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters