Commit 850d50e
General: Improve caching in get_calendar function.
Replace the monolithic calendar cache (single array storing all variations)
with individual cache keys per calendar variation, reducing deserialization
overhead on cache reads.
Switch cache invalidation from `save_post` and `delete_post` hooks to
`clean_post_cache`, which avoids unnecessary cache flushes on autosaves,
revision cleanup, and draft saves.
Use `wp_cache_flush_group()` to invalidate all calendar cache entries,
with a generation counter fallback for object cache implementations
that do not support group flushing.
Replace MySQL date arithmetic query with PHP native `gmdate()` to
eliminate an unnecessary database roundtrip for week-to-month
calculation.
Props spacedmonkey, narenin.
Fixes #61343.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent a1c062c commit 850d50e
3 files changed
Lines changed: 93 additions & 24 deletions
File tree
- src/wp-includes
- tests/phpunit/tests/general
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
568 | | - | |
569 | | - | |
| 568 | + | |
570 | 569 | | |
571 | 570 | | |
572 | 571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2341 | 2341 | | |
2342 | 2342 | | |
2343 | 2343 | | |
2344 | | - | |
2345 | | - | |
2346 | 2344 | | |
2347 | | - | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
2348 | 2354 | | |
2349 | | - | |
| 2355 | + | |
2350 | 2356 | | |
2351 | 2357 | | |
2352 | 2358 | | |
| |||
2356 | 2362 | | |
2357 | 2363 | | |
2358 | 2364 | | |
2359 | | - | |
2360 | | - | |
2361 | | - | |
2362 | | - | |
2363 | 2365 | | |
2364 | 2366 | | |
2365 | 2367 | | |
| |||
2376 | 2378 | | |
2377 | 2379 | | |
2378 | 2380 | | |
2379 | | - | |
2380 | | - | |
| 2381 | + | |
2381 | 2382 | | |
2382 | 2383 | | |
2383 | 2384 | | |
| |||
2390 | 2391 | | |
2391 | 2392 | | |
2392 | 2393 | | |
2393 | | - | |
2394 | 2394 | | |
2395 | 2395 | | |
2396 | 2396 | | |
2397 | | - | |
2398 | | - | |
2399 | | - | |
2400 | | - | |
2401 | | - | |
2402 | | - | |
2403 | | - | |
| 2397 | + | |
2404 | 2398 | | |
2405 | 2399 | | |
2406 | 2400 | | |
| |||
2583 | 2577 | | |
2584 | 2578 | | |
2585 | 2579 | | |
2586 | | - | |
2587 | | - | |
| 2580 | + | |
2588 | 2581 | | |
2589 | 2582 | | |
2590 | 2583 | | |
| |||
2618 | 2611 | | |
2619 | 2612 | | |
2620 | 2613 | | |
2621 | | - | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
2622 | 2621 | | |
2623 | 2622 | | |
2624 | 2623 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
195 | 266 | | |
0 commit comments