Redis Hashes Explained

Sdílet
Vložit
  • čas přidán 26. 07. 2024
  • Hashes are one of the most useful Redis data structures. In this explainer, we’ll introduce you to the most common Hash commands, including HSET, HGET, and HINCRBY. We’ll also show you how to use Redis Hashes to model a simple domain object for an imaginary online role-playing game!
    Links:
    Redis University → university.redis.com/
    Redis Labs → www.redis.com/
    Redis.io Hash Documentation → redis.io/topics/data-types#ha...
    Need a Redis cluster now? Sign up for a free Redis Cloud Essentials account → bit.ly/2wasiCa
    Join our discord server → / discord
  • Věda a technologie

Komentáře • 36

  • @Redheadtama1
    @Redheadtama1 Před 10 měsíci +5

    And that, ladies and gentleman, is how you make an educational video! Bravo!

    • @Redisinc
      @Redisinc  Před 10 měsíci

      Thank you very much! Always appreciate hearing that! - Justin

  • @effin-e
    @effin-e Před 23 dny

    This is explained incredibly well! Really, REALLY well. Thank you :)

  • @Naru1243
    @Naru1243 Před 2 lety +16

    These videos are so amazingly produced, thank you so much. These deserve so much more attention. q.q

    • @Redisinc
      @Redisinc  Před 2 lety

      Wow, thank you so much Naru! Much appreciated! - Justin

  • @user-mb3jv4yg1n
    @user-mb3jv4yg1n Před 2 lety +2

    Very nice! Much thanks for this video. amazing content!

  • @xedumenx
    @xedumenx Před 2 lety

    This is awesome!

  • @maximhlinsky6488
    @maximhlinsky6488 Před 3 lety +3

    Хорошо объяснил. Спсибо. (explained well. Thanks.)

  • @AlexPoma
    @AlexPoma Před 2 lety

    Wow, this was an amazing example 👏

    • @Redisinc
      @Redisinc  Před 2 lety

      Thanks Alex! We keep talking about actually making a Mages & Minotaurs game someday. Maybe we'll make an open source crowd effort? - Justin

  • @brus5
    @brus5 Před 7 měsíci +1

    Thank you sir!

  • @leandrogonzalez5587
    @leandrogonzalez5587 Před 2 měsíci +1

    Is it possible to set an expiration time for each field and not for the key?

  • @miracletechteam7918
    @miracletechteam7918 Před rokem

    Thank you for the video!
    I have questions... because HashSlots is 16,384 so we can only do hset up to 16,384? (* if no HDel executed)

  • @dfytq
    @dfytq Před 2 lety

    Understood all. But how do people manage to cache query along with its results set. Specifically filter queries/search queries. In a typical scenario, people input some values/conditions in input field, based on that input, system goes to database, finds the records and sent it back to the user, displayed in grid. How this search params and conditions should be stored in redis?

  • @tom111_14
    @tom111_14 Před 11 měsíci

    you have specified gold of 20 and when running the command of HGETALL it print out 140, i suppose the video was made is different times

  • @jimwichen7978
    @jimwichen7978 Před rokem

    Every time I was in an interview, the interviewer always asked me about how the Redis Hashes were implemented.
    And I said, "I don't know. What I know is how to use them".

    • @Redisinc
      @Redisinc  Před rokem +1

      Looking under the hood of Redis and examining the data structures *under* the Redis data structures could be a good topic for a stream or video! - Justin

  • @capnnukasun810
    @capnnukasun810 Před 2 lety +1

    Nice dice

  • @albertoneto1180
    @albertoneto1180 Před 2 lety +2

    Amazing explanation 🎉🎉🎉
    Imagine you want to return field X from a list of players, how can you select them?
    Player:1
    Player:3
    Player:5
    How to get values for the players 3 and 5 in one go? To avoid round trips to the db?
    Thank you

    • @Redisinc
      @Redisinc  Před 2 lety +1

      Hi Alberto! You might want to check out integrating Lua scripts with your Redis server to atomically execute multiple commands. Check out the docs here:
      redis.io/docs/manual/programmability/
      Hope this helps! - Justin

  • @EmadSaeed
    @EmadSaeed Před 3 měsíci

    thanks

  • @AleksandarT10
    @AleksandarT10 Před měsícem

    What's the performance of the Redis Hashes? I want to store several properties in the Hash that I will be updating/removing on a regular basis (every 1 second). Is there any performance impact?

  • @fernandocristan8339
    @fernandocristan8339 Před 2 lety

    Nice explanation!!
    Its possible to filter a key with especific value?
    All players in level 4 e.g.
    Thanks!

    • @Redisinc
      @Redisinc  Před 2 lety +1

      Thanks, Fernando! I would recommend integrating RediSearch for filtering and searching within hashes. The Redis Om client has made this a pleasure to do.

  • @RickHenderson
    @RickHenderson Před rokem

    Great video. Have you heard of a game called Dungeons and Dragons? It's very good. Will Mages and Minotaurs be playable from the Redis command line? :) I might have to check out RU.

    • @Redisinc
      @Redisinc  Před rokem

      Hi there - we did make a playable maze/dungeon type game check out our video here: czcams.com/video/cowIZWASJNs/video.html

  • @vtchkrcn
    @vtchkrcn Před 2 lety

    The value of the gold is set to 20 during the player 42 init at 2:15. Why the value of the gold is 140 after running hgetall command at 2:23?

    • @Redisinc
      @Redisinc  Před 2 lety +2

      Whoah! Good catch! That was an error. I think we reused some of the command line interface footage after I called HINCRBY at 4:16. It should have been 20 still at 2:23. Sorry about that! - Justin

  • @manjunathbukkapatnam3731

    Is redis field and value could be of List type on python3.9.16 ? Thanks

    • @Redisinc
      @Redisinc  Před rokem

      Hi there - no, in a hash the values are always string types although you can store binary data / JSON encoded data in there etc. To have Redis operate on data like a list, check out the List, Stream and JSON data types.

  • @grjesus9979
    @grjesus9979 Před 6 měsíci +2

    Why use the word hash to name it? It is just like a JSON file.

    • @Redisinc
      @Redisinc  Před 5 měsíci +1

      I'd counter by saying that a JSON file is just like a Hash. Hashes have existed before JSON, and as a simple look up table of just keys and associated values, it meets a LOT of needs. This was also released before we launched our JSON capability. Now people are free to pick and choose which data structure works best for them. Hashes can still excel over JSON in a few scenarios due to their flat nature, so care should be given when deciding the best data structure to use.

  • @jacques6090
    @jacques6090 Před 2 lety

    I'm doing RU101 now, and in my humble opinion, it would be great if you can turn off the background music.

    • @Redisinc
      @Redisinc  Před 2 lety

      Thanks for that, we removed audio in future videos.

  • @TheAremoh
    @TheAremoh Před rokem

    Nice video.
    I'm currently using Redis-OM with FastAPI, NO SUCH INDEX using the find method. I'm using the aredis_om module. Any idea why this is happening?
    Thank you.

    • @Redisinc
      @Redisinc  Před rokem

      Hi Aremoh, this is a great question to post in our discord, we can definitely help you! discord.com/invite/redis