Opened 3 years ago

Closed 9 months ago

#15361 closed defect (bug) (duplicate)

wp_start_object_cache() should be called within blog switching methods instead of wp_cache_init()

Reported by: prettyboymp Owned by:
Priority: normal Milestone:
Component: Cache Version:
Severity: normal Keywords:
Cc: mpretty@…, simon@…, willmot

Description

The switch_to_blog() and restore_current_blog() functions call wp_cache_init() directly, which causes the object cache instance to be recreated. These methods should instead be calling the wp_start_object_cache() method which correctly checks whether wp_cache_init() or wp_cache_reset() should be used.

Attachments (1)

16258.diff (682 bytes) - added by prettyboymp 3 years ago.

Download all attachments as: .zip

Change History (15)

Related: #14992

  • Component changed from General to Cache
  • Cc mpretty@… added
  • Milestone changed from Awaiting Review to 3.1
  • Resolution set to fixed
  • Status changed from new to closed

(In [16359]) Use wp_start_object_cache() in switch_to_blog(). Props prettyboymp. Fixes #15361

  • Summary changed from w_start_object_cache() should be called within blog switching methods instead of wp_cache_init() to wp_start_object_cache() should be called within blog switching methods instead of wp_cache_init()

comment:7   ryan3 years ago

We don't really need to re-add global and non-persistent groups or do those file and function exists checks. Maybe switch_to_blog() should directly call wp_cache_reset() if it exists otherwise do wp_cache_init().

  • Resolution fixed deleted
  • Status changed from closed to reopened

Suggesting we revert the changeset, for this reason:

http://core.trac.wordpress.org/ticket/14992#comment:7

(In [16597]) Revert [16359]. Deal with it in 3.2. see #15361

  • Milestone changed from 3.1 to Future Release
  • Cc simon@… added
  • Cc willmot added
  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

I think this is mostly handled now by #21434.

Note: See TracTickets for help on using tickets.