#11409 closed enhancement (wontfix)
wp_count_comments() should be cached in a transient.
Reported by: | Denis-de-Bernardy | Owned by: | ryan |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Optimization | Keywords: | needs-patch |
Focuses: | Cc: |
Description
wp_count_comments() gets called on every admin page. It's not a super expensive on, but it probably belongs in a transient that gets updated whenever the number of pending comment changes.
Attachments (1)
Change History (12)
#6
@
15 years ago
- Keywords has-patch added; needs-patch removed
Patch attached against r13330 to change wp_cache_get/set to transient.
#7
follow-up:
↓ 8
@
15 years ago
- Keywords needs-patch added; has-patch removed
We'd also need to update/clear the transient whenever the number of pending comments changes.
#8
in reply to:
↑ 7
;
follow-up:
↓ 9
@
15 years ago
Replying to nacin:
We'd also need to update/clear the transient whenever the number of pending comments changes.
Sorry, I thought about that and then forgot just as quickly...
This is a little more complex than just pending comment change since the object stored in the transient has counts for total_comments, approved, moderated, spam, trash and post-trash statuses. Not sure how to proceed w/this.
#9
in reply to:
↑ 8
@
15 years ago
Replying to chrisscott:
Replying to nacin:
We'd also need to update/clear the transient whenever the number of pending comments changes.
This is a little more complex than just pending comment change since the object stored in the transient has counts for total_comments, approved, moderated, spam, trash and post-trash statuses. Not sure how to proceed w/this.
We can bust the transient during a comment status change.
Nice find, this is for the menu. Maybe we should cache the number of plugins as well or isn't that already chached, right?