Replacing all ets table content atomically

Can’t find a way to replace whole ets table (i.e. all records) at once.

  • There is tab2list function, but no list2tab.
  • file2tab crates table, doesn’t update existing one
  • Emptying existing table + insert leaves the gap in between. insert operation is atomic by itself, but combination of two calls is not

Maybe some smart merging will help, deleting stale records, updating existing records after that, but that’s expensive and feels wrong.

Context: i’m getting list of items from outside every X minutes, and want to cache them, to be used in app

Create another table and point to it, then delete the old one, ala generational caching?

1 Like

Thanks, i’ll try this way