Tutorial by Examples

Redis keys are binary-safe, so literally anything can be used as a key. The only limitations are that they must be less than 512MB. Examples of valid keys: 7 ++++ `~!@#$%^&*()-_=+ user:10134 search/9947372/?query=this%20is%20a%28test%29%20query <div id="div64"> Any othe...
For clarity and maintainability, it is often recommended to develop a system or schema for naming your Redis keys. Here are some examples of common and maintainable systems for naming your keys: user:10134 user:10134:favorites user:10134:friends user:10134:friends-of-friends user:10134 user:...
You can list all of the keys in a Redis database by executing the following commands from redis-cli: KEYS * The parameter to KEYS is a glob-style pattern matching expression. Examples of suppored patterns include: h?llo matches hello, hallo and hxllo h*llo matches hllo and heeeello h[ae]llo ...
The expiration values of a key can be managed by a user outside of the update commands. Redis allows a user to determine the current time to live (TTL) of a key using the TTL command: TTL key This command will return the TTL of a key in seconds or will return the special values -1 or -2. A -1 ...
Redis provides two functions for removing keys from the database: del and unlink. The del function removes one or more keys from the database. The del command causes Redis to immediately reclaim the memory for the deleted key on the current thread of execution. The execution time for del is propo...
Redis provides the SCAN command to iterate over the keys in the database matching a particular pattern. Redis supports glob style pattern matching in the SCAN command. The SCAN command provides a cursor-based iterator over the Redis keyspace. The iterative call sequence to SCAN starts with the us...

Page 1 of 1