-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding bulkinsert support #246
Conversation
/// </summary> | ||
/// <param name="items">The items to insert.</param> | ||
/// <returns>null.</returns> | ||
Task BulkInsert(IEnumerable<T> items); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This should yield the IDs of the items inserted into Redis. Not the full KeyNames, just the ids. That should be returned by the call to
Set
within the method. - This should just be named
Insert
and should just overload the regular behavior. - This should have an overload to accept a timespan so folks can do TTL with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slorello89, I got your point here this method should return List<string> ids
this must be the behavior of the method but the issue is with Call to Set
within this method. Because the method is a Task
typo which accepts it not a string type.
/// <inheritdoc/>
public async Task<List<string>> Insert(IEnumerable<T> items, TimeSpan timeSpan)
{
var tasks = new List<Task<string>>();
foreach (var item in items.Distinct())
{
tasks.Add(_connection.SetAsync(item, timeSpan));
}
await Task.WhenAll(tasks);
var result = tasks.Select(x => x.Result).ToList();
return result;
}
test/Redis.OM.Unit.Tests/RediSearchTests/SearchFunctionalTests.cs
Outdated
Show resolved
Hide resolved
@Jeevananthan-23 Thanks for submitting this, couple of comments about what the api should look like (also looks like a lot of stylistic stuff in the test class which distracts from what's going on in it). |
f3239f1
to
e9559cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 thanks for submitting this @Jeevananthan-23 :)
Close #238 - Adding a feature to Bulk Insert data into Redis with the help of pipelines.