Redis Data with Spring Boot - Distributed Lock Implementation With Redis

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ม.ค. 2025

ความคิดเห็น • 14

  • @SurendraAccenture
    @SurendraAccenture ปีที่แล้ว

    How can we call the runTask method inside PlayGroundService for our POST call endpoint. i want to reduce the number of DB calls and lock the functionality of POST endpoint.

  • @saitejareddy6892
    @saitejareddy6892 2 ปีที่แล้ว

    Quick question: Is there a way, how we can identify the instance that has acquired a specific lock from redis ? There can be consumers across different instances that may have acquired these locks, so identifying the source IP/instance info can help in solving some usecases.

    • @mirza_2023
      @mirza_2023 2 ปีที่แล้ว

      You could add that info to the technical logs, so have instance IID and log it when it gets the lock

    • @saitejareddy6892
      @saitejareddy6892 2 ปีที่แล้ว

      @@mirza_2023 the question is mainly to have a way to retrieve the list of locks acquired by an instance via application logic in code. This can be helpful when we want to gracefully shut down individual instances based on any locks being acquired or not. Spring integration with redis provides a way to get lock registry uuid which is unique to an instance. So, I am looking something similar to this at framework/lib level. Anyways I think, we may have to maintain this list somewhere at instance level to solve this.

  • @abhisranjan
    @abhisranjan ปีที่แล้ว

    You did not mention how RedisTemplate was autowired

  • @lankesh870
    @lankesh870 2 ปีที่แล้ว

    How does redis handle concurrent writes internally? Could you point me to some resource? I need to understand how redis ensures race condition does not occur when two clients tries to write to same key simultaneously.

    • @liliumbosniacumcode
      @liliumbosniacumcode  2 ปีที่แล้ว +1

      Redis handles its operations sequentially, so you do not need to worry about it, it should not be possible for it to write same two keys at the same time

    • @lankesh870
      @lankesh870 2 ปีที่แล้ว

      @@liliumbosniacumcode Yes. But how? Any doc you can refer to check on the internal mechanism of concurrency handling done by redis.

    • @liliumbosniacumcode
      @liliumbosniacumcode  2 ปีที่แล้ว

      @@lankesh870 redis.io/docs/manual/transactions/

  • @TanNguyen-yu4el
    @TanNguyen-yu4el 3 ปีที่แล้ว

    Hi, this is a very useful redis series, can you guide HOW TO EXPIRE ALL KEYS VALUE IN REDIS. Thank you very much.

    • @liliumbosniacumcode
      @liliumbosniacumcode  3 ปีที่แล้ว +1

      As far as I know there is no way to expire keys in bulk, you would need to do it one by one
      redis.io/commands/expire

  • @kayeshparvez
    @kayeshparvez 3 ปีที่แล้ว

    Hi, could you please show us the implementation of lru and lfu cache ?

  • @kayeshparvez
    @kayeshparvez 3 ปีที่แล้ว

    This one is tough for me to understand :(