Open
Conversation
权限检查优化: - Role::can() 使用 once() 缓存 permissions 集合,避免重复查询 - HasPermissions::can() 预构建 slug/id 映射数组,使用 isset() 快速查找 - HasPermissions::isRole() 和 inRoles() 同样优化为映射数组查找 缓存优化: - 菜单缓存默认开启(config admin.menu.cache.enable = true) - Role::getPermissionId() 使用 Laravel Cache 缓存查询结果 - 权限/角色变更时自动清除缓存 导出内存优化: - AbstractExporter::normalize() 直接遍历 Collection,避免 toArray() 内存拷贝 所有优化兼容 Laravel Octane 等常驻内存环境,使用 once() 提供请求级缓存。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
性能提升
变更文件
src/Models/Role.phpsrc/Traits/HasPermissions.phpsrc/Grid/Exporters/AbstractExporter.phpconfig/admin.phpOctane 兼容性
once()而非实例属性缓存once()而非实例属性缓存Test plan