diff options
| author | unwox <me@unwox.com> | 2024-10-17 14:31:22 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-17 14:31:22 +0600 |
| commit | 08370b6f302f93cae01b0521f29a62c20e97bdab (patch) | |
| tree | d4862634ea0668ac83c0fc06fff2a4e471c49e95 /lib | |
| parent | ff8c6c9dde3a877b51e2fabafa579e2c05dc856e (diff) | |
implement cache clearing by namespaces
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/cache.fnl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/cache.fnl b/lib/cache.fnl index b21a05e..8cf7323 100644 --- a/lib/cache.fnl +++ b/lib/cache.fnl @@ -15,7 +15,10 @@ [key value])) value) -(fn clear-tx [tx] - (must (luna.db.exec-tx tx "DELETE FROM cache" []))) +(fn clear-tx [tx prefix] + (if (= "string" (type prefix)) + (must (luna.db.exec-tx tx "DELETE FROM cache WHERE key LIKE ?" + [(.. prefix "%")])) + (must (luna.db.exec-tx tx "DELETE FROM cache" [])))) {: get :set _set : clear-tx} |
