def __setitem__(self, key, value):
<EOL>if self.empty_cache:<EOL><INDENT>self.refresh()<EOL><DEDENT>with transaction.atomic():<EOL><INDENT>self.model.objects.filter(name=key).delete()<EOL>self.model.objects.create(name=key, value=value)<EOL><DEDENT>super(SettingDict, self).__setitem__(key, value)<EOL>
Tries to delete and then creates a setting, in case the value type has
changed. Otherwise, we would need to get, update (if same type), or
delete and create (if not same type).