-
Hi - I have [de]serialization working fine thanks to a previous answer! The downside is that I discovered that I must save the cache at two different process exits: SIGINT (for systemd STOP) and exit after extended idle. The 2nd one was easy, the first is causing real problems. I'm using the ctrlc crate; which uses an FnOnce to perform the exit. I can't move || the cache into the function I suspect I've got the wrong implementation for this improvement. Currently its a struct declared in main() and borrowed when needed I've tried lazy_static!, but can't get the right definition. I'm thinking here that the FnOnce() will have access to static My absolute first attempt was a Drop::drop() on the struct. It worked in #[test] context, but the destructor isn't called in --release mode. That probably doesn't make sense, but there it is. It looks to me that it has something to do with the moka library already dropping the cache before the cache goes out of scope. I tried looking at instances of drop() in the code, but as I can't solve this problem, that code is impenetrable. I'm not sure what other alternatives there are to saving the cache before process exit. tia, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I created Box as a lazy_static. On to the next problem |
Beta Was this translation helpful? Give feedback.
I created Box as a lazy_static. On to the next problem