Add whitelist support to OPcache
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
OPcache currently supports excluding files using opcache.blacklist_filename. This works well when the number of files to exclude is small.
However, in a multi-tenant application, the opposite can be true. There may be a large number of tenant-specific files that should not be cached, while only a small set of common application files should be cached.
For example, instead of maintaining:
/var/www/tenant-a/*
/var/www/tenant-b/*
/var/www/tenant-c/*
...
it would be useful to define the files that are allowed to be cached:
opcache.whitelist_filename=/path/to/whitelist
with:
/var/www/app/src/*
/var/www/app/vendor/*
The behavior would simply be the inverse of the blacklist: when a whitelist is configured, only matching files are cached.
I think blacklist and whitelist should be mutually exclusive, with PHP-FPM failing at startup if both are configured.
This would be particularly useful for applications where the set of files that should be cached is small and well-defined, while the set of files to exclude is large or dynamic.
I'm happy to implement this and open a PR if this proposal makes sense.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查 OPcache 现有的 opcache.blacklist_filename 配置,以及提案中描述的 PHP-FPM 启动行为。确定 whitelist 配置和 blacklist/whitelist 互斥性应放在哪里;完成的标准是只有 whitelist 中的文件会被缓存,并且在同时配置两个设置时 PHP-FPM 会在启动时失败。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- backend, performance
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100