Fixed app config to always check the DB and not trust the cache

Sometimes the cache already contains default values that don't exist yet
in the database. The setValue() method has been fixed to not trust these
values and do an update with fallback to insert.