Avoid duplicated keys in ProtectedBranches cache
Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/387978 **Problem** Sometimes we provide a `ProjectPresenter` object to the CacheService. Because we use `object.class.name` for the Redis key generation, it leads to duplicated keys problem when Project and ProjectPresenter objects generate different keys. **Solution** * Extract CacheKey generation logic into a separate class * Use `is_a?` (via case statement) to identify object type Changelog: performance
显示
- app/models/protected_branch/cache_key.rb 51 个添加, 0 个删除app/models/protected_branch/cache_key.rb
- app/services/protected_branches/cache_service.rb 1 个添加, 17 个删除app/services/protected_branches/cache_service.rb
- spec/models/protected_branch/cache_key_spec.rb 66 个添加, 0 个删除spec/models/protected_branch/cache_key_spec.rb
app/models/protected_branch/cache_key.rb
0 → 100644
想要评论请 注册 或 登录