public async Task SaveStateAsync(string stateId, object state, CancellationToken cancellationToken, int ExpiryTime = 3600) { if (string.IsNullOrWhiteSpace(stateId)) { throw new ArgumentNullException(nameof(stateId)); } if (state == null) { throw new ArgumentNullException(nameof(state)); } byte[] serializedValue; using (new ProfileContext("State serialization")) serializedValue = _serializationFacade.Serialize(state); try { var settings = await _settingsProvider.GetSettings(); var recordKey = GetRecordKey(settings, stateId); var bin = new Bin(Keystore.AerospikeKeys.BinNames.ObjectState, serializedValue); var client = GetClient(settings); await client.Put(GetRecordPolicy(ExpiryTime), cancellationToken, recordKey, bin); } catch (Exception ex) { throw new AerospikeProviderException(Keystore.AerospikeKeys.Errors.AerospikeOperationError, ex); } }
public byte[] Format(object obj) { return(_serializationFacade.Serialize(obj)); }