Automattic / Automattic/VIP-Coding-Standards

Enhance logic of LowCacheTime to minimize noise.

未关闭
#408 1 条评论 1 个 reaction 已指派 1 人 已被 @rebeccahum 认领 在 GitHub 查看
Status: Has PR Type: Enhancement
主要语言
PHP
星标
261
派生
44
平均合并
19 分钟
30 天内合并 PR
1

描述

`❗️ Warning: Low cache expiry time of "wp_rand( 5 * MINUTE_IN_SECONDS, 10 * MINUTE_IN_SECONDS )", it is recommended to have 300 seconds or more (WordPressVIPMinimum.Cache.LowExpiryCacheTime.LowCacheTime).`

`wp_cache_set( $latest_blocks_cache_key, $latest_blocks, null, wp_rand( 5 * MINUTE_IN_SECONDS, 10 * MINUTE_IN_SECONDS ) );`

## What problem would the enhancement address for VIP?
It is very common for clients to use constants HOUR_IN_SECONDS, DAY_IN_SECONDS, MINUTE_IN_SECONDS and to also vary the duration to not have cache stampedes.

## Describe the solution you'd like
Can we enhance the logic of the ruleset to not flag for common usages?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。