Brandon Keepers - I'm looking for recommendatio...

I'm looking for recommendations on caching data values in plugins. The tides plugin uses navigation.position, but if I turn off instruments and restart the server, then I lose position. So I am thinking the plugin will just persist last known position to a json file in the plugin data dir and fall back to that if no position is available. Any other recommendations?
3 Replies
Scott Bender
Scott Bender2mo ago
Right now, I think that’s the best option. Take a look at the anchor alarm plugin, it persists some data that way.
Teppo Kurki
Teppo Kurki2mo ago
…or implement a periodic save of the latest state in a simple json file Is this for generic, global state or plugin internal data?
Brandon Keepers
Brandon KeepersOP2mo ago
that's pretty much what I'm planning to do. It currently subscribes to navigation.position on a fixed interval. So I'll just write that to json. Then on startup, if position is not available, fall back to reading from the plugin

Did you find this page helpful?