#37464 closed enhancement (fixed)
Last changed helper function
Reported by: | spacedmonkey | Owned by: | jorbin |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Cache API | Keywords: | has-patch needs-unit-tests |
Focuses: | performance | Cc: |
Description
The last changed value is used to invalidate many caches in core. Getting the code to last changed value is repeated through the core.
Attachments (3)
Change History (21)
#1
follow-up:
↓ 3
@
8 years ago
- Keywords has-patch 4.7-early added
- Milestone changed from Awaiting Review to Future Release
This ticket was mentioned in Slack in #core by helen. View the logs.
8 years ago
#3
in reply to:
↑ 1
@
8 years ago
- Milestone changed from Future Release to 4.7
Replying to DrewAPicture:
Also, we should follow current naming conventions and add
wp_get_
to the front of the function name.
Would wp_cache_get_last_changed()
be a more descriptive name? 37464.1.diff seems good otherwise.
#4
@
8 years ago
The fact that the incrementor is tied to the "last change" seems like an implementation detail that shouldn't matter to people building cache keys. The important fact is that it's an incrementor. What do people think about wp_get_cache_incrementor()
?
#5
@
8 years ago
I think wp_cache_get_last_changed()
sounds like the best name. It is an implementation detail, but I think this function is clearly tied to implementation and is not overly generalized.
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
8 years ago
#8
@
8 years ago
- Keywords needs-refresh added; 4.7-early removed
Docbloc for new function is also incomplete
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
#10
@
8 years ago
- Keywords needs-refresh removed
Updated patch changes the function name to wp_cache_get_last_changed()
and updates the Docblock.
Would this function be something that needs to be pluggable for when other caching mechanisms are in use? If so, then maybe this should go in cache.php
instead of function.php
.
This ticket was mentioned in Slack in #core by desrosj. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by desrosj. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by desrosj. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
#17
@
8 years ago
Is it too late in 4.7 to consider a wp_cache_set_last_changed()
?
wp_cache_set( 'last_changed', microtime(), $foo );
is also used 11 times in core.
#18
@
23 months ago
I’ve opened a pull request for this: https://core.trac.wordpress.org/ticket/37464
@spacedmonkey: Thanks for the patch. Looks like 37464.diff is missing inline documentation. Also, we should follow current naming conventions and add
wp_get_
to the front of the function name.