summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cache.fnl7
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}