summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/fetch.fnl2
-rw-r--r--lib/cache.fnl7
2 files changed, 6 insertions, 3 deletions
diff --git a/bin/fetch.fnl b/bin/fetch.fnl
index da5383d..4558c50 100644
--- a/bin/fetch.fnl
+++ b/bin/fetch.fnl
@@ -144,7 +144,7 @@
ipuer.products
ozchai.products])]
(store-products tx (products)))
-(cache.clear-tx tx)
+(cache.clear-tx tx "page:")
(must (luna.db.commit tx))
(populate-search-table)
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}