fixed 项目名称,标识,所有者变化时重置缓存

This commit is contained in:
xxq250 2023-05-18 10:21:32 +08:00
parent ee62c394fc
commit 2aeaee8479
1 changed files with 7 additions and 0 deletions

View File

@ -238,6 +238,13 @@ class ProjectsController < ApplicationController
def simple
# 为了缓存活跃项目的基本信息,后续删除
Cache::V2::ProjectCommonService.new(@project.id).read
# 项目名称,标识,所有者变化时重置缓存
project_common = $redis_cache.hgetall("v2-project-common:#{@project.id}")
if project_common.present?
if project_common["name"] != @project.name || project_common["identifier"] != @project.identifier || project_common["owner_id"] != @project.user_id
Cache::V2::ProjectCommonService.new(@project.id).reset
end
end
json_response(@project, current_user)
end