otwarchive-symphonyarchive/lib/work_chapter_count_caching.rb

16 lines
442 B
Ruby
Raw Normal View History

2026-03-11 22:22:11 +00:00
# This module is included by both the work and chapter models
module WorkChapterCountCaching
def key_for_chapter_posted_counting(work)
"/v1/chapters_posted/#{work.id}"
end
def key_for_chapter_total_counting(work)
"/v1/chapters_total/#{work.id}"
end
def invalidate_work_chapter_count(work)
Rails.cache.delete(key_for_chapter_total_counting(work))
Rails.cache.delete(key_for_chapter_posted_counting(work))
end
end