function [OK, key, warnings] = remoteStorePlain(val, keysToClear)
% Add value to value store and return storage key or error

% Copyright 2020 The MathWorks, Inc.

wc = parallel.internal.general.WarningsCollector();
pClearIfNecessary(keysToClear);

try
    key = spmdlang.ValueStore.store(val);
    OK = true;
catch E
    OK = false;
    key = E;
end
warnings = wc.Warnings;
end
