def set_value(
        self, name, value, ttl=None, local=True, scope=SYSTEM_SCOPE, encrypt=False
    ):
        """
        Store a value in a dictionary which is local to this class.
        """

        name = self._get_full_key_name(name=name, local=local)

        instance = KeyValuePair()
        instance.id = name
        instance.name = name
        instance.value = value
        if ttl:
            self._logger.warning(
                "MockDatastoreService is not able to expire keys based on ttl."
            )
            instance.ttl = ttl

        self._datastore_items[name] = instance
        return True

        Store a value in a dictionary which is local to this class.
        
st2tests/st2tests/mocks/datastore.py