changeset 103:e7d7a568411c

Fix broken SharedCache
author Risto Saarelma <risto.saarelma@iki.fi>
date Fri, 04 Aug 2023 13:07:17 +0300
parents dc425adf42b3
children 3d158edc4991
files inner/src/lib.rs
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/inner/src/lib.rs	Fri Aug 04 13:06:15 2023 +0300
+++ b/inner/src/lib.rs	Fri Aug 04 13:07:17 2023 +0300
@@ -368,9 +368,17 @@
 
     let vis = &func.vis;
 
-    let flusher = quote::quote! {
-        #vis fn #flush_name() {
-            #store_ident.with(|ATTR_MEMOIZE_HM__| ATTR_MEMOIZE_HM__.borrow_mut().clear());
+    let flusher = if options.shared_cache {
+        quote::quote! {
+            #vis fn #flush_name() {
+                #store_ident.lock().unwrap().clear();
+            }
+        }
+    } else {
+        quote::quote! {
+            #vis fn #flush_name() {
+                #store_ident.with(|ATTR_MEMOIZE_HM__| ATTR_MEMOIZE_HM__.borrow_mut().clear());
+            }
         }
     };