Skip to main content

More about local storage on the Pioreactor

How do I write and read from the local storage?

Here's an example:

from pioreactor.utils import local_intermittent_storage, local_peristant_storage

with local_intermittent_storage("my_cache") as cache:
cache['key'] = "value"

with local_peristant_storage("my_longterm_storage") as cache:
cache['key'] = "value"

You can use pio view-cache <name> to view the contents of <name>, and pio clear-cache <name> <key> to clear contents.

What's the difference between local_intermittent_storage and local_peristant_storage?

local_intermittent_storage is data that won't, or shouldn't, exist after a reboot. For example: the state of GPIO pins. At a hardware level, this is reset after each reboot, and so should data associated with it.

Whereas local_peristant_storage is data that should exist between reboots. This is data like calibration data, or OD blank data.