Ticket #4743 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Fix cache stomping in get_bookmarks()

Reported by: josephscott Assigned to: anonymous
Priority: normal Milestone: 2.3
Component: Administration Version:
Severity: normal Keywords: has-patch
Cc: josephscott

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

bookmark.php.diff (0.8 kB) - added by josephscott on 08/13/07 20:02:17.

Change History

08/13/07 20:02:17 changed by josephscott

  • attachment bookmark.php.diff added.

08/13/07 20:12:28 changed by markjaquith

Stomping because of high concurrency of cache adds?

08/13/07 20:32:27 changed by ryan

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

08/14/07 16:18:37 changed by josephscott

  • cc set to josephscott.

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.

08/16/07 18:12:13 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

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