Alias RedisObjectCollection
Models a strongly typed set of numbered hashes.
This structure is roughly equivalent of a T[long].
Declaration
alias RedisObjectCollection(T, vibe .db .redis .idioms .RedisCollectionOptions OPTIONS, ulong ID_LENGTH) = RedisCollection!(RedisObject!T,OPTIONS,ID_LENGTH);
See also
Example
struct User {
string name;
string email;
int age;
string password;
}
void test()
{
auto db = connectRedis("127.0.0.1") .getDatabase(0);
db .deleteAll();
auto users = RedisObjectCollection!User(db, "users");
assert(users .add(User("Tom", "tom@example.com", 42, "secret")) == 0);
assert(users .add(User("Peter", "peter@example.com", 42, "secret")) == 1);
auto peter = users[1];
assert(peter .name == "Peter");
}
Authors
Sönke Ludwig
Copyright
© 2014 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.