diff options
| author | unwox <me@unwox.com> | 2024-10-17 14:32:27 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-17 14:32:27 +0600 |
| commit | 359790c402d2731b7dd1df8a629726e69922a035 (patch) | |
| tree | 6b6fc8110cefc76fccea51069a17e54bf22bd30c /bin | |
| parent | 08370b6f302f93cae01b0521f29a62c20e97bdab (diff) | |
cache fixes for spelling mistakes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/serve.fnl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl index e574238..9d83b10 100644 --- a/bin/serve.fnl +++ b/bin/serve.fnl @@ -335,9 +335,12 @@ (category-menu-path (. form.tags 1)) nil)) (local spellfix-suggestion - (if (and (not (str.empty? form.query)) items (< 0 (# items))) - nil - (spellfix.guess form.query))) + (if (and (not (str.empty? form.query)) items (= 0 (# items))) + (cache.wrap + db (.. "spellfix:" form.query) + #(spellfix.guess form.query)) + nil)) + [:html {:lang "ru-RU"} [:head {} [:meta {:charset "utf-8"}] @@ -372,7 +375,7 @@ [:footer {} paginator]]]]]]) (fn root-handler [{: path : query}] - (local cache-key (.. path "?" (serialize-query query))) + (local cache-key (.. "page:" path "?" (serialize-query query))) (local cached (cache.get db cache-key)) (if cached (values 200 {:content-type "text/html"} cached) |
