{"id":24986,"date":"2023-05-09T09:15:09","date_gmt":"2023-05-09T07:15:09","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=24986"},"modified":"2023-05-09T09:17:57","modified_gmt":"2023-05-09T07:17:57","slug":"redis-the-different-key-type-part1","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/","title":{"rendered":"Redis: The different Key Type Part1"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction:<\/h2>\n\n\n\n<p>Hi team , we have seen during previous posts, how is working <strong>Redis <\/strong>, how to browse into data using <strong>Redis Insight<\/strong> and how to backup your database.<\/p>\n\n\n\n<p>This time , in this first part ,we will go deeper by checking the <strong>different key type<\/strong> ,how to use it and their limitation.<\/p>\n\n\n\n<p>So let&#8217;s go!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">About Redis<\/h2>\n\n\n\n<p>As a reminder,let&#8217;s take a look again on the major advantages of using a Redis database:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png\" alt=\"\" class=\"wp-image-24990\" width=\"1115\" height=\"263\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-300x71.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-768x181.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1.png 1376w\" sizes=\"auto, (max-width: 1115px) 100vw, 1115px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Keys<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Definition<\/li>\n<\/ul>\n\n\n\n<p><strong>Redis keys are binary safe, this means that you can use any binary sequence as a key, from a string like &#8220;foo&#8221; to the content of a JPEG file. The empty string is also a valid key.<\/strong><\/p>\n\n\n\n<p><span style=\"text-decoration: underline\">Best practice about keys:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Very long keys are not a good idea. For instance a key of 1024 bytes is a bad idea not only memory-wise, but also because the lookup of the key in the dataset may require several costly key-comparisons. Even when the task at hand is to match the existence of a large value, hashing it (for example with SHA1) is a better idea, especially from the perspective of memory and bandwidth.<\/li>\n\n\n\n<li>Very short keys are often not a good idea. There is little point in writing &#8220;<strong>u1000flw<\/strong>&#8221; as a key if you can instead write &#8220;<strong>user:1000:followers<\/strong>&#8220;. The latter is more readable and the added space is minor compared to the space used by the key object itself and the value object. While short keys will obviously consume a bit less memory, your job is to find the right balance.<\/li>\n\n\n\n<li>Try to stick with a schema. For instance &#8220;<strong>object-type:id<\/strong>&#8221; is a <strong>good idea<\/strong>, as in &#8220;user:1000&#8221;. Dots or dashes are often used for multi-word fields, as in &#8220;comment:4321:reply.to&#8221; or &#8220;comment:4321:reply-to&#8221;.<\/li>\n\n\n\n<li>The maximum allowed key size is <strong>512 MB<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>Of course I invite you <strong>to visit Redis site<\/strong> which is really complete and useful ( also a lot of Redis item definition you will find here are extracted from the Redis official site itself.)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The different Key type<\/h2>\n\n\n\n<p>Below you will see all Key Type you can find on Redis ( I used <strong>RedisInsight <\/strong>to show you that )<\/p>\n\n\n\n<p>Note that the commands are not case sensitive , in other words a <strong>HSET <\/strong>and a <strong>hset <\/strong>or <strong>HSeT <\/strong>will give the same result \ud83d\ude42<\/p>\n\n\n\n<p>We will list them and give:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Their definition <\/li>\n\n\n\n<li>The basic commands<\/li>\n\n\n\n<li>A quick example<\/li>\n\n\n\n<li>The limitation of each command.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"269\" height=\"361\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD.png\" alt=\"\" class=\"wp-image-24987\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD.png 269w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD-224x300.png 224w\" sizes=\"auto, (max-width: 269px) 100vw, 269px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Hash Type <\/h2>\n\n\n\n<p>Hashes  are record types structured as collections of field-value pairs. You can use hashes to represent basic objects and to store groupings of counters, among other things.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Basic commands<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/redis.io\/commands\/hset\"><code><strong>HSET<\/strong><\/code><\/a> sets the value of one or more fields on a hash.<\/li>\n\n\n\n<li><a href=\"https:\/\/redis.io\/commands\/hget\"><code><strong>HGET<\/strong><\/code><\/a> returns the value at a given field.<\/li>\n\n\n\n<li><a href=\"https:\/\/redis.io\/commands\/hmget\"><code><strong>HMGET<\/strong><\/code><\/a> returns the values at one or more given fields.<\/li>\n\n\n\n<li><a href=\"https:\/\/redis.io\/commands\/hincrby\"><code><strong>HINCRBY<\/strong><\/code><\/a> increments the value at a given field by the integer provide<\/li>\n\n\n\n<li><strong><a href=\"http:\/\/redis.io\/commands\/hgetall\"><code>HGETALL<\/code> <\/a><\/strong>\u2013 Displays the entire hash content.<\/li>\n\n\n\n<li><a href=\"http:\/\/redis.io\/commands\/hdel\"><strong><code>HDEL<\/code><\/strong> <\/a>\u2013 Removes an existing key-value pair from a hash.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Example<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1025\" height=\"718\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3.png\" alt=\"\" class=\"wp-image-25052\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3.png 1025w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3-300x210.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3-768x538.png 768w\" sizes=\"auto, (max-width: 1025px) 100vw, 1025px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"limits\">Limits<\/h4>\n\n\n\n<p>Every hash can store up to <strong>4,294,967,295<\/strong> (2^32 &#8211; 1) field-value pairs. In practice, your hashes <strong>are limited only by the overall memory on the VMs hosting your Redis deployment<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"ftoc-heading-3\">Lists<\/h2>\n\n\n\n<p>Redis allows you to associate an ordered sequence of strings to a key. This <strong>linked list of strings<\/strong> lets you perform a set of operations such as:<\/p>\n\n\n\n<p><strong>Basic commands<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/redis.io\/commands\/lpush\"><code>LPUSH<\/code><\/a> <\/strong>adds a new element to the head of a list; <a href=\"https:\/\/redis.io\/commands\/rpush\"><code>RPUSH<\/code><\/a> adds to the tail.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/lpop\"><code>LPOP<\/code><\/a> <\/strong>removes and returns an element from the head of a list; <a href=\"https:\/\/redis.io\/commands\/rpop\"><code>RPOP<\/code><\/a> does the same but from the tails of a list.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/llen\"><code>LLEN<\/code><\/a> <\/strong>returns the length of a list.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/lmove\"><code>LMOVE<\/code><\/a> <\/strong>atomically moves elements from one list to another.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/ltrim\"><code>LTRIM<\/code><\/a> <\/strong>reduces a list to the specified range of elements.<\/li>\n\n\n\n<li><a href=\"https:\/\/redis.io\/commands\/rpush\"><strong><code>RPUSH<\/code><\/strong> <\/a>\u2013 Pushes the value to the tail end of the list.<\/li>\n\n\n\n<li><a href=\"https:\/\/redis.io\/commands\/lrange\"><strong><code>LRANGE<\/code><\/strong> <\/a>\u2013 Retrieves a range of items.<\/li>\n\n\n\n<li><strong><code><a href=\"https:\/\/redis.io\/commands\/lpop\">LPOP<\/a>\/<\/code><a href=\"https:\/\/redis.io\/commands\/rpop\"><code>RPOP<\/code> <\/a><\/strong>\u2013 Used to display and remove items from both ends.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/lindex\"><code>LINDEX<\/code> <\/a><\/strong>\u2013 Obtain a value from a specific position within the list.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD3.png\" alt=\"\" class=\"wp-image-25054\" width=\"520\" height=\"343\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD3.png 324w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD3-300x198.png 300w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Sets<\/h2>\n\n\n\n<p>A Redis set is an unordered collection of unique strings (members). You can use Redis sets to efficiently:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Track unique items (e.g., track all unique IP addresses accessing a given blog post).<\/li>\n\n\n\n<li>Represent relations (e.g., the set of all users with a given role).<\/li>\n\n\n\n<li>Perform common set operations such as intersection, unions, and differences.<\/li>\n<\/ul>\n\n\n\n<p><strong>Basic commands<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/redis.io\/commands\/sadd\"><code>SADD<\/code><\/a> <\/strong>adds a new member to a set.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/srem\"><code>SREM<\/code><\/a> <\/strong>removes the specified member from the set.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/sismember\"><code>SISMEMBER<\/code><\/a> <\/strong>tests a string for set membership.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/sinter\"><code>SINTER<\/code><\/a> <\/strong>returns the set of members that two or more sets have in common (i.e., the intersection).<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/scard\"><code>SCARD<\/code><\/a> <\/strong>returns the size (a.k.a. cardinality) of a set.<\/li>\n\n\n\n<li><a href=\"https:\/\/redis.io\/commands\/smembers\/\"><strong><code>SMEMBERS<\/code><\/strong> <\/a>\u2013 Retrieves all items from a set.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD4-1024x374.png\" alt=\"\" class=\"wp-image-25056\" width=\"950\" height=\"346\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD4-1024x374.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD4-300x109.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD4-768x280.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD4.png 1036w\" sizes=\"auto, (max-width: 950px) 100vw, 950px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"limits\">Limits<\/h4>\n\n\n\n<p>The max size of a Redis set is 2^32 &#8211; 1 (<strong>4,294,967,295<\/strong>) members.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sorted sets<\/h2>\n\n\n\n<p>A Redis sorted set is a collection of unique strings (members) ordered by an associated score. When more than one string has the same score, the strings are ordered lexicographically. Some use cases for sorted sets include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Leaderboards. For example, you can use sorted sets to easily maintain ordered lists of the highest scores in a massive online game.<\/li>\n\n\n\n<li>Rate limiters. In particular, you can use a sorted set to build a sliding-window rate limiter to prevent excessive API requests.<\/li>\n<\/ul>\n\n\n\n<p><strong> Basic commands<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/redis.io\/commands\/zadd\"><code>ZADD<\/code><\/a> <\/strong>adds a new member and associated score to a sorted set. If the member already exists, the score is updated.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/zrange\"><code>ZRANGE<\/code><\/a> <\/strong>returns members of a sorted set, sorted within a given range.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/zrank\"><code>ZRANK<\/code><\/a> <\/strong>returns the rank of the provided member, assuming the sorted is in ascending order.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/zrevrank\"><code>ZREVRANK<\/code><\/a> <\/strong>returns the rank of the provided member, assuming the sorted set is in descending order.<\/li>\n\n\n\n<li><strong><code><a href=\"http:\/\/redis.io\/commands\/zrangebyscore\">ZRANGEBYSCORE <\/a><\/code><\/strong>\u2013 Fetches items from the sorted set based on the defined score range. The <strong><code>withscores<\/code> <\/strong>option produces the actual score values.<strong><code>ZREM<\/code> \u2013<\/strong> Removes items from a sorted set.<\/li>\n<\/ul>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Let&#8217;s use <strong>Redinsight <\/strong>to create the sorted set:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"482\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD5-1024x482.png\" alt=\"\" class=\"wp-image-25059\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD5-1024x482.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD5-300x141.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD5-768x362.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD5.png 1291w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li> We will create a new user and a score:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD7-1024x551.png\" alt=\"\" class=\"wp-image-25060\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD7-1024x551.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD7-300x162.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD7-768x414.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD7.png 1285w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>List the score of the players:<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD8.png\" alt=\"\" class=\"wp-image-25061\" width=\"769\" height=\"277\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD8.png 406w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD8-300x108.png 300w\" sizes=\"auto, (max-width: 769px) 100vw, 769px\" \/><\/figure>\n\n\n\n<p><strong><span style=\"text-decoration: underline\">Note:<\/span><\/strong><\/p>\n\n\n\n<p>Using <strong>ZREVRANK <\/strong>will display the rank of user from the highest score to the lowest , also first rank will start with <strong>0<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD9.png\" alt=\"\" class=\"wp-image-25063\" width=\"764\" height=\"302\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD9.png 400w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD9-300x119.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Strings<\/h2>\n\n\n\n<p>Redis strings store sequences of bytes, including text, serialized objects, and binary arrays. As such, strings are the most basic Redis data type. They&#8217;re often used for caching, but they support additional functionality that lets you implement counters and perform bitwise operations, too.<\/p>\n\n\n\n<p><strong>Basic Commands<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/redis.io\/commands\/set\"><code>SET<\/code><\/a> <\/strong>stores a string value.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/setnx\"><code>SETNX<\/code><\/a> <\/strong>stores a string value only if the key doesn&#8217;t already exist. Useful for implementing locks.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/get\"><code>GET<\/code><\/a> <\/strong>retrieves a string value.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/redis.io\/commands\/mget\"><code>MGET<\/code><\/a> <\/strong>retrieves multiple string values in a single operation<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"565\" height=\"256\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD91.png\" alt=\"\" class=\"wp-image-25064\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD91.png 565w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD91-300x136.png 300w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/figure>\n\n\n\n<p><strong>Limits <\/strong><\/p>\n\n\n\n<p>By default, a single Redis string can be a maximum of <strong>512 <\/strong>MB.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>We have seen some of useful Redis command to create keys and play with it , there is some other remaining but we will see that in another post.<\/p>\n\n\n\n<p>For the moment I invite you to share with us , visit the <a href=\"https:\/\/www.dbi-services.com\/blog\/\">dbi bloggers<\/a> and also to check <a href=\"https:\/\/www.dbi-services.com\/blog\/redis-backup-and-restore-your-database\/\">my other blogs<\/a> for Control-M or Jenkins for example :).<\/p>\n\n\n\n<p>Stay tuned <strong>for the part 2<\/strong>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Hi team , we have seen during previous posts, how is working Redis , how to browse into data using Redis Insight and how to backup your database. This time , in this first part ,we will go deeper by checking the different key type ,how to use it and their limitation. So let&#8217;s [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1739],"tags":[],"type_dbi":[],"class_list":["post-24986","post","type-post","status-publish","format-standard","hentry","category-nosql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Redis: The different Key Type Part1 - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redis: The different Key Type Part1\" \/>\n<meta property=\"og:description\" content=\"Introduction: Hi team , we have seen during previous posts, how is working Redis , how to browse into data using Redis Insight and how to backup your database. This time , in this first part ,we will go deeper by checking the different key type ,how to use it and their limitation. So let&#8217;s [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-09T07:15:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-09T07:17:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png\" \/>\n<meta name=\"author\" content=\"Middleware Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Middleware Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/\"},\"author\":{\"name\":\"Middleware Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"headline\":\"Redis: The different Key Type Part1\",\"datePublished\":\"2023-05-09T07:15:09+00:00\",\"dateModified\":\"2023-05-09T07:17:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/\"},\"wordCount\":1129,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png\",\"articleSection\":[\"NoSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/\",\"name\":\"Redis: The different Key Type Part1 - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png\",\"datePublished\":\"2023-05-09T07:15:09+00:00\",\"dateModified\":\"2023-05-09T07:17:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Redis: The different Key Type Part1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\",\"name\":\"Middleware Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"caption\":\"Middleware Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Redis: The different Key Type Part1 - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/","og_locale":"en_US","og_type":"article","og_title":"Redis: The different Key Type Part1","og_description":"Introduction: Hi team , we have seen during previous posts, how is working Redis , how to browse into data using Redis Insight and how to backup your database. This time , in this first part ,we will go deeper by checking the different key type ,how to use it and their limitation. So let&#8217;s [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/","og_site_name":"dbi Blog","article_published_time":"2023-05-09T07:15:09+00:00","article_modified_time":"2023-05-09T07:17:57+00:00","og_image":[{"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png","type":"","width":"","height":""}],"author":"Middleware Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Middleware Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/"},"author":{"name":"Middleware Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"headline":"Redis: The different Key Type Part1","datePublished":"2023-05-09T07:15:09+00:00","dateModified":"2023-05-09T07:17:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/"},"wordCount":1129,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png","articleSection":["NoSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/","url":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/","name":"Redis: The different Key Type Part1 - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png","datePublished":"2023-05-09T07:15:09+00:00","dateModified":"2023-05-09T07:17:57+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/REDISCMD1-1024x242.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/redis-the-different-key-type-part1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Redis: The different Key Type Part1"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1","name":"Middleware Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","caption":"Middleware Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/24986","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=24986"}],"version-history":[{"count":46,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/24986\/revisions"}],"predecessor-version":[{"id":25079,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/24986\/revisions\/25079"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=24986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=24986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=24986"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=24986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}