def METHOD_NAME(self, key, value):
    key = self.add_prefix(key)
    try:
        constance = self._model._default_manager.get(key=key)
    except (OperationalError, ProgrammingError):
        # database is not created, noop
        return
    except self._model.DoesNotExist:
        old_value = None
        constance = self._model._default_manager.create(key=key, value=value)
    else:
        old_value = constance.value
        constance.value = value
        constance.save()
    if self._cache:
        self._cache.METHOD_NAME(key, value)
    signals.config_updated.send(
        sender=config, key=key, old_value=old_value, new_value=value
    )