Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#57905 closed enhancement (fixed)

Add last changed cache helper function

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

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.


4 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:


4 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:


4 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
4 years ago

  • Milestone Awaiting Review6.3
  • Version trunk

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:


3 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:


3 years ago
#7

@peterwilsoncc @SergeyBiryukov Any more input on this?

#8 @spacedmonkey
3 years ago

  • Keywords commit added
  • Owner set to spacedmonkey
  • Status newassigned

#9 @spacedmonkey
3 years ago

  • Resolutionfixed
  • Status assignedclosed

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:


3 years ago
#10

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

#12 @spacedmonkey
3 years ago

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

#13 @stevenlinx
3 years ago

  • Keywords add-to-field-guide added

#14 @flixos90
3 years ago

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

#15 @spacedmonkey
3 years ago

#58656 was marked as a duplicate.

#16 @spacedmonkey
3 years ago

#45662 was marked as a duplicate.

Note: See TracTickets for help on using tickets.