mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-05 00:00:44 -04:00
Invalidate sort result cache after change sort_title
This commit is contained in:
@@ -81,9 +81,17 @@ class Entry
|
||||
@title
|
||||
end
|
||||
|
||||
def sort_title=(sort_title : String | Nil)
|
||||
def set_sort_title(sort_title : String | Nil, username : String)
|
||||
Storage.default.set_entry_sort_title id, sort_title
|
||||
@sort_title = sort_title
|
||||
|
||||
[false, true].each do |ascend|
|
||||
[SortMethod::Auto, SortMethod::Title].each do |sort_method|
|
||||
sorted_entries_cache_key = SortedEntriesCacheEntry.gen_key @book.id,
|
||||
username, @book.entries, SortOptions.new(sort_method, ascend)
|
||||
LRUCache.invalidate sorted_entries_cache_key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def sort_title_db
|
||||
|
||||
@@ -300,9 +300,18 @@ class Title
|
||||
@title
|
||||
end
|
||||
|
||||
def sort_title=(sort_title : String | Nil)
|
||||
def set_sort_title(sort_title : String | Nil, username : String)
|
||||
Storage.default.set_title_sort_title id, sort_title
|
||||
@sort_title = sort_title
|
||||
|
||||
[false, true].each do |ascend|
|
||||
[SortMethod::Auto, SortMethod::Title].each do |sort_method|
|
||||
sorted_entries_cache_key =
|
||||
SortedEntriesCacheEntry.gen_key @id, username, @entries,
|
||||
SortOptions.new(sort_method, ascend)
|
||||
LRUCache.invalidate sorted_entries_cache_key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def sort_title_db
|
||||
|
||||
Reference in New Issue
Block a user