Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#4743 closed defect (bug) (fixed)

Fix cache stomping in get_bookmarks()

Reported by: josephscott's profile 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 18 years ago.

Download all attachments as: .zip

Change History (5)

#1 @markjaquith
18 years ago

Stomping because of high concurrency of cache adds?

#2 @ryan
18 years ago

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

#3 @josephscott
18 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.

#4 @ryan
18 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.