Add locking to controller

Maps aren't thread-safe, so we should use locking.  We can't use
sync.Mutex from runtime though - so we have to use the C lock
mechanism that is already part of the runtime package.
Start working on cache ignore/disable

We may want to not use the cache - so start setting up the ability to
do this.  Ignore means write but don't read, and disable means neither
read nor write.