settings: cache keyfile databases for "timestamps" and "seen-bssids"

Only read the keyfile databases once and cache them for the remainder of
the program.

- this avoids the overhead of opening the file over and over again.

- it also avoids the data changing without us expecting it. The state
  files are internal and we don't support changing it outside of
  NetworkManager. So in the base case we read the same data over
  and over. In the worst case, we read different data but are not
  interested in handling the changes.

- only write the file when the content changes or before exiting
  (normally).

- better log what is happening.

- our state files tend to grow as we don't garbage collect old entries.
  Keeping this all in memory might be problematic. However, the right
  solution for this is that we come up with some form of garbage
  collection so that the state files are reaonsably small to begin with.
12 jobs for th/cache-state-keyfiles in 31 minutes (queued for 1 second)
Status Job ID Name Coverage
  Test
passed #283325
allowed to fail
checkpatch

00:01:24

passed #283332
t_debian:9

00:13:39

passed #283334
t_debian:sid

00:13:04

manual #283333
allowed to fail manual
t_debian:testing
passed #283326
t_fedora:28

00:21:23

passed #283327
t_fedora:29

00:31:00

passed #283328
t_fedora:30

00:21:37

manual #283329
allowed to fail manual
t_fedora:rawhide
passed #283330
t_ubuntu:16.04

00:13:52

passed #283331
t_ubuntu:18.04

00:16:30

 
  External
failed NetworkManager test verification

failed NetworkManager test verification

06:00:01