貌似删除操作不会更新缓存 还是先不用缓存吧
This commit is contained in:
parent
87fe066695
commit
fa3b216e0f
|
@ -695,12 +695,13 @@ class CoursesController < ApplicationController
|
||||||
# 显示老师和助教的活动
|
# 显示老师和助教的活动
|
||||||
# @authors = searchTeacherAndAssistant(@course)
|
# @authors = searchTeacherAndAssistant(@course)
|
||||||
@authors = course_all_member(@course)
|
@authors = course_all_member(@course)
|
||||||
Dir.glob("#{Rails.root}/app/models/*.rb").sort.each { |file| require file }
|
#TODO 貌似删除操作不会更新缓存 还是先不用缓存吧
|
||||||
|
# Dir.glob("#{Rails.root}/app/models/*.rb").sort.each { |file| require file }
|
||||||
events = []
|
events = []
|
||||||
key = "course_events_#{@course.id}".to_sym
|
# key = "course_events_#{@course.id}".to_sym
|
||||||
if Rails.env.production? && Setting.course_cahce_enabled?
|
# if Rails.env.production? && Setting.course_cahce_enabled?
|
||||||
events = Rails.cache.read(key) || []
|
# events = Rails.cache.read(key) || []
|
||||||
end
|
# end
|
||||||
if events.empty?
|
if events.empty?
|
||||||
@authors.each do |author|
|
@authors.each do |author|
|
||||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||||
|
@ -716,7 +717,7 @@ class CoursesController < ApplicationController
|
||||||
events += @activity.events(@days, @course.created_at, :is_public => 1)
|
events += @activity.events(@days, @course.created_at, :is_public => 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled?
|
# Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled?
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# @author = @course.teacher
|
# @author = @course.teacher
|
||||||
|
|
Loading…
Reference in New Issue