WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#4743 closed defect (bug) (fixed)

Fix cache stomping in get_bookmarks()

Reported by: josephscott Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

The cache in get_bookmarks() can stomp on itself, resulting in cache misses even after adding it to the cache.

I'm including a patch that breaks the cache up based on the value of $category.

Attachments (1)

bookmark.php.diff (815 bytes) - added by josephscott 7 years ago.

Download all attachments as: .zip

Change History (5)

josephscott7 years ago

comment:1 markjaquith7 years ago

Stomping because of high concurrency of cache adds?

comment:2 ryan7 years ago

category is part of key, shouldn't that take care of it?

comment:3 josephscott7 years ago

  • Cc josephscott added

After looking at this further the diff has problems and really isn't needed.

My initial thought was that the cache was getting stomped because it wasn't breaking it out into enough different groups. This was true, but not really the issue.

The problem is using wp_cache_add, which is fine if you are storing one "thing", but we have an array of things that change. So we should be using wp_cache_set.

comment:4 ryan7 years ago

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

(In [5879]) Set instead of add since the cache value has multiple keys that can change. Props josephscott. fixes #4743

Note: See TracTickets for help on using tickets.