diff options
| author | unwox <me@unwox.com> | 2025-01-29 23:12:10 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2025-01-29 23:18:00 +0600 |
| commit | 1eb0d60cad414b0cafe1c38b3a0b7823c0c8fb28 (patch) | |
| tree | a1ec3afc4ff91544b3e2722f53de5a084a04dbcb /lib | |
| parent | 4e4880fd6631f46138fabee5e20ddc22c84ac6bd (diff) | |
do not lock writes to db while running "./run.sh fetch"
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/cache.fnl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/cache.fnl b/lib/cache.fnl index 76ede13..fdde74c 100644 --- a/lib/cache.fnl +++ b/lib/cache.fnl @@ -15,11 +15,11 @@ [key value])) value) -(fn clear-tx [tx prefix] +(fn clear [db prefix] (if (= "string" (type prefix)) - (must (luna.db.exec-tx tx "DELETE FROM cache WHERE key LIKE ?" + (must (luna.db.exec db "DELETE FROM cache WHERE key LIKE ?" [(.. prefix "%")])) - (must (luna.db.exec-tx tx "DELETE FROM cache" [])))) + (must (luna.db.exec db"DELETE FROM cache" [])))) (fn wrap [db key f] (local cached (get db key)) @@ -28,4 +28,4 @@ (let [res (f)] (if res (_set db key res) nil)))) -{: get :set _set : clear-tx : wrap} +{:get get :set _set :clear clear :wrap wrap} |
