How does TranslationUnit.SetValue() works?


I'm trying to use the two methods "TranslationUnit.SetValue()" and "TranslationUnit.GetValue()"  in order to store a custom value per-tu in my plugin implementation. However I'm not able to make it work. In my search function, I've added this code snippet:

public SearchResults SearchTranslationUnit(SearchSettings settings, TranslationUnit translationUnit)
logger.Info("BEFORE SET: " + translationUnit.GetValue("my-custom-value")?.GetValueString());
translationUnit.SetValue(new SingleStringFieldValue("my-custom-value", "Hello world"), true);
logger.Info("AFTER SET: " + translationUnit.GetValue("my-custom-value")?.GetValueString());

So my guess was that, after the first SET, I would have being able to get the value "Hello world" in the first "BEFORE SET". Problem is that, no matter how many time a focus the same segment in the Editor page, the value is never actually stored in the Translation Unit, and my log file is full of these messages:

[2019-10-28 10:32:29.8553] INFO MyProviderLanguageDirection - BEFORE SET: 
[2019-10-28 10:32:29.8553] INFO MyProviderLanguageDirection - AFTER SET: "Hello world"
[2019-10-28 10:32:30.3620] INFO MyProviderLanguageDirection - BEFORE SET:
[2019-10-28 10:32:30.3818] INFO MyProviderLanguageDirection - AFTER SET: "Hello world"

So what am I doing wrong?

Thanks for your help!