RedisSetCollection

Models a strongly typed numbered set of values.

template RedisSetCollection (
T
RedisCollectionOptions OPTIONS = RedisCollectionOptions.defaults
size_t ID_LENGTH = 1
) {}

Members

Aliases

RedisSetCollection
alias RedisSetCollection = RedisCollection!(RedisSet!T, OPTIONS, ID_LENGTH)
Undocumented in source.

Examples

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"));
}

Meta