vibe.d beta banner
get vibe.d
0.7.30

Alias RedisSetCollection

Models a strongly typed numbered set of values.

Declaration

alias RedisSetCollection(T, vibe.db.redis.idioms.RedisCollectionOptions OPTIONS, ulong ID_LENGTH) = RedisCollection!(RedisSet!T,OPTIONS,ID_LENGTH);

Example

void test()
{
	auto db = connectRedis("127.0.0.1").getDatabase(0);
	auto user_groups = RedisSetCollection!(string, RedisCollectionOptions.none)(db, "user_groups");

	// add some groups for user with ID 0
	user_groups[0].insert("cooking");
	user_groups[0].insert("hiking");
	// add some groups for user with ID 1
	user_groups[1].insert("coding");

	assert(user_groups[0].contains("hiking"));
	assert(!user_groups[0].contains("coding"));
	assert(user_groups[1].contains("coding"));

	user_groups[0].remove("hiking");
	assert(!user_groups[0].contains("hiking"));
}
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.