Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 22 months ago

#57905 closed enhancement (fixed)

Add last changed cache helper function

Reported by: tillkruess's profile tillkruess Owned by: spacedmonkey's profile spacedmonkey
Milestone: 6.3 Priority: normal
Severity: minor Version:
Component: Cache API Keywords: has-patch add-to-field-guide has-dev-note
Focuses: performance Cc:

Description

As mentioned in https://core.trac.wordpress.org/ticket/37464#comment:17 and in https://core.trac.wordpress.org/ticket/57625#comment:6

This PR adds the wp_cache_set_last_changed()

function to fire the wp_cache_set_last_changed action when a cache group's last_changed timestamp was updated.

Change History (16)

This ticket was mentioned in PR #4214 on WordPress/wordpress-develop by @tillkruess.


2 years ago
#1

This is a follow up to #4077 as suggest by @peterwilsoncc and @JJJ.

This PR adds the wp_cache_set_last_changed() function to fire the wp_cache_set_last_changed action when a cache group's last_changed timestamp was updated.

Trac ticket: https://core.trac.wordpress.org/ticket/57905

@tillkruess commented on PR #4214:


2 years ago
#3

Thanks @tillkruss, Left some nit-pick feedback.

Thanks. Should I always use the version number, instead of n.e.x.t?

@tillkruess commented on PR #4214:


2 years ago
#4

This is pretty much what I was thinking, does this need an update following 82cd434?

I don't think so, because the groups won't change. posts last-changed will be stored in post-queries group.

#5 @peterwilsoncc
2 years ago

  • Milestone changed from Awaiting Review to 6.3
  • Version trunk deleted

The linked pull request looks good to me, let's try to get this in 6.3.

It would be good to get some tests in too, both direct and indirect.

Indirect tests would be to ensure the action fires when inserting/updating/deleting objects that bump the last changed value.

@spacedmonkey commented on PR #4214:


2 years ago
#6

@tillkruss This PR needs to be rebased after. https://github.com/WordPress/wordpress-develop/commit/19bd759db57b4f1cc72157a446915ffbafdd838e. I will re-review after this is done.

@tillkruess commented on PR #4214:


2 years ago
#7

@peterwilsoncc @SergeyBiryukov Any more input on this?

#8 @spacedmonkey
2 years ago

  • Keywords commit added
  • Owner set to spacedmonkey
  • Status changed from new to assigned

#9 @spacedmonkey
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 55702:

Cache API: Add helper function wp_cache_set_last_changed.

Add a helper function called wp_cache_set_last_changed to set the last changed value for cache groups. This function has a new action called wp_cache_set_last_changed, allowing for developers to cache invalidate when last changed value is changed.

Props tillkruess, spacedmonkey, peterwilsoncc, mukesh27, johnjamesjacoby.
Fixes #57905.

@tillkruess commented on PR #4214:


2 years ago
#10

I think this is ready to be merged. Any feedback @SergeyBiryukov?

#12 @spacedmonkey
2 years ago

  • Focuses performance added
  • Keywords needs-dev-note added; commit removed

#13 @stevenlinx
2 years ago

  • Keywords add-to-field-guide added

#14 @flixos90
2 years ago

  • Keywords has-dev-note added; needs-dev-note removed

#15 @spacedmonkey
2 years ago

#58656 was marked as a duplicate.

#16 @spacedmonkey
22 months ago

#45662 was marked as a duplicate.

Note: See TracTickets for help on using tickets.