Designed with developers in mind and unlike simplistic key-value data stores, Redis data structures deliver flexible ways to model your data for many use cases in modern applications. These sophisticated data structures enable you to develop applications with fewer lines of elegant code to store, access, and use your data and enable powerful and speedy in-memory processing.
These data structures avoid the overhead associated with translation between application objects to database entities for every database operation.
One of the most versatile of Redis’ building blocks, Redis Strings is a binary-safe data structure. It can store any kind of data–a string, integer, floating point value, JPEG image, serialized Ruby object, or anything else you want it to carry. Operate on a whole string or parts, and increment or decrement integers and floats.
Redis Sets data structure stores a unique set of members. With Sets, you can add, fetch, or remove members, check membership, or retrieve a random member. You can also perform set operations such as intersection, union, and set difference and compute set cardinality.
Redis Sorted Sets contain a unique set of members ordered by floating-point scores. As with Sets, you can add, fetch, or remove individual members and perform set operations such as union, intersection, set difference, and compute cardinality. Furthermore, you can also query the set based on score or member value, aggregate, filter, and order results.
Redis Lists holds collections of string elements sorted according to their order of insertion. Push or pop items from both ends, trim based on offsets, read individual or multiple items, or find or remove items by value and position. You can also make blocking calls for asynchronous message transfers.
Similar to documents in a document store or rows in a relational database, the Redis Hashes structure stores a set of field-value pairs. It provides the ability to add, fetch, or remove individual items and fetch the entire hash, or use one or more fields in the hash as a counter.
Redis Bitmaps is a compact data structure to store binary logic and states. It provides commands to fetch and set a bit value at a given position, and perform AND, OR, XOR, and NOT operations between multiple bitmap keys.
Bitfields offer an efficient, compact way to implement multiple counters in a single array. It allows incrementing and decrementing counters at a given position, and flags overflow when the counter reaches its upper limit.
Redis HyperLogLog is a probabilistic data structure used to count unique values (set cardinality) at a constant memory size. You can add and count a large number of unique items with memory efficiency, and merge two or more HyperLogLog data structures into one.
Geospatial indexes provide an extremely efficient and simple way to manage and use geospatial data in Redis. You can add unique items with latitude and longitude, compute the distance between objects, and find members within a given radius range from a location.
Redis Streams is an incredibly powerful data structure for managing high-velocity data streams (like a message queue). With out-of-the-box partitioning, replication, and persistence, it can capture and process millions of data points per second at sub-millisecond latency. Redis Streams is based on an efficient radix-tree implementation, which makes the range and lookup queries extremely fast. It connects producers and consumers with asynchronous calls and supports consumer groups.