A Redis set is an unordered collection of unique strings. Two things make it valuable: membership tests are instant, and Redis can compute intersections, unions, and differences between sets inside the database. That turns questions like "is this user following that one," "what tags do these two articles share," and "how many unique visitors today" into single fast commands, instead of loops in your application code.

This is part 6 of the Redis Masterclass, following lists and queues.

The basics: unique membership

A set stores unique values and tells you fast whether something is in it:

SADD article:1:tags "redis" "database" "caching"