Foreach (查找)
对于管道中的每条记录,运行一些作。
Redis 堆栈 |
---|
public GearsBuilder<T> foreach(
gears.operations.ForeachOperation<T> foreach)
Defines a set of operations to run for each record in the pipe.
Parameters
Name
Type
Description
foreach
ForeachOperation
The set of operations to run for each record
Returns
Returns a GearsBuilder object with a new template type.
Example
For each person hash, add a new full_name field that combines their first and last names:
GearsBuilder.CreateGearsBuilder(reader).foreach(r->{
String firstName = r.getHashVal().get("first_name");
String lastName = r.getHashVal().get("last_name");
r.getHashVal().put("full_name", firstName + lastName);
});
On this page