Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#14817 closed defect (bug) (invalid)

update_post_cache() fails when an object is already in the cache

Reported by: misterbisson's profile misterbisson Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch needs-testing
Focuses: Cc:


The function uses wp_cache_add(), which cannot replace an existing object for the cache key. Should use wp_cache_set(), which happily replaces existing objects or inserts new ones.

Attached patch fixes.

Attachments (1)

update_post_cache_fix.diff (305 bytes) - added by misterbisson 14 years ago.

Download all attachments as: .zip

Change History (5)

#1 @misterbisson
14 years ago

  • Keywords has-patch needs-testing added

#2 @scribu
14 years ago

Related: #15452

#3 @ryan
14 years ago

Despite the name, the update_cache functions aren't meant to update things already in the cache. They are cache primers and typically use add. If some place is using update_post_cache() to update cache values that needs to be fixed.

#4 @mdawaffe
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Looks like every place in core is using this function correctly (to prime).

Closing as invalid. Please reopen with more details if you find somewhere where the function is being used improperly.

Note: See TracTickets for help on using tickets.