dfp token cache uses cache collector pattern without locking

Created on 11 September 2016, almost 9 years ago
Updated 20 July 2025, 8 days ago

The dfp_token_replace function uses the cache collector pattern, where several keys are stored in a cache item per page.

However no locking is used, which means web requests can play cache ping-pong:

Request A:

- get cache

Request B:

- get cache
- $cache['/']['B'] = '...';
- set cache

Request A:

- $cache['/']['A'] = '...';
- set cache

Request B:

- get cache
- cache miss again => re-do the cache

In the worst case and given the high granularity of the keys of being per user per node/term per tag this can lead to a lot of cache misses and hence also to increased cache UPDATE traffic.

Also CACHE_TEMPORARY is always refreshed for even very old data, could use CACHE_PERMANENT instead, then.

Solution:

Use locking or use its own cache_bin + one cache_get_multiple() instead.

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇩🇪Germany Fabianx

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024