mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
Add :sorted_entries
suffix to gen_key
This commit is contained in:
parent
51806f18db
commit
15a54f4f23
@ -63,10 +63,11 @@ class SortedEntriesCacheEntry < CacheEntry(Array(String), Array(Entry))
|
|||||||
|
|
||||||
def self.gen_key(book_id : String, username : String,
|
def self.gen_key(book_id : String, username : String,
|
||||||
entries : Array(Entry), opt : SortOptions?)
|
entries : Array(Entry), opt : SortOptions?)
|
||||||
sig = Digest::SHA1.hexdigest (entries.map &.id).to_s
|
entries_sig = Digest::SHA1.hexdigest (entries.map &.id).to_s
|
||||||
user_context = opt && opt.method == SortMethod::Progress ? username : ""
|
user_context = opt && opt.method == SortMethod::Progress ? username : ""
|
||||||
Digest::SHA1.hexdigest (book_id + sig + user_context +
|
sig = Digest::SHA1.hexdigest (book_id + entries_sig + user_context +
|
||||||
(opt ? opt.to_tuple.to_s : "nil"))
|
(opt ? opt.to_tuple.to_s : "nil"))
|
||||||
|
"#{sig}:sorted_entries"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user