async function set (key, value) {
  if (JSON_ENCODED_SETTINGS.includes(key)) {
    value = JSON.stringify(value)
  }
  await setupPromise.then(() => cbPromise(cb => {
    db.run(`
      INSERT OR REPLACE
        INTO settings (key, value, ts)
        VALUES (?, ?, ?)
    `, [key, value, Date.now()], cb)
  }))
  if (CACHED_VALUES.includes(key)) cachedValues[key] = value
  events.emit('set', key, value)
  events.emit('set:' + key, value)
}
@param {string} key
@param {string | number | object} value
@returns {Promise<void>}