vibe.d beta banner
get vibe.d
0.8.1

Asynchronous I/O that doesn’t get in your way, written in D

Alias RedisSetCollection

Models a strongly typed numbered set of values.

alias RedisSetCollection(T, RedisCollectionOptions OPTIONS = RedisCollectionOptions.defaults, ulong ID_LENGTH = 1) = 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.