Skip to content

Instantly share code, notes, and snippets.

View kelvinndmo's full-sized avatar
🏠
Working from home

Novak kelvinndmo

🏠
Working from home
View GitHub Profile

Optimistic locking is a concurrency control technique used to manage data consistency in multi-user environments, particularly when dealing with distributed systems or databases. In our specific case, we are implementing optimistic locking with Redis to address concurrency issues when multiple requests attempt to update the same data simultaneously. The core idea behind optimistic locking is to allow multiple operations to proceed independently until the point of updating the shared data. Rather than blocking all but the first request, optimistic locking relies on versioning the data. Each time the data is updated, a version number is associated with it. When a request wants to modify the data, it checks the version number to ensure it matches the expected value. If the version matches, the update proceeds, and the version is incremented for the next update. If the version does not match, it indicates that the data has been modified by another request, and the current request must retry the operation with the

@kelvinndmo
kelvinndmo / interview.md
Last active April 15, 2024 12:43
Software Engineering Intern Question

Objective: Build a Rick and Morty Character Viewer

Description

Your task is to create a simple web page that fetches data from the Rick and Morty API (Rick and Morty API) and displays information about characters. You need to display at least the following details for each character:

  • Name
  • Image