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"); }
Models a strongly typed set of numbered hashes.
This structure is roughly equivalent of a T[long].