🚀 Day 21 – Java Backend Journey | Redis Basics Today I focused on learning the basics of Redis, a powerful in-memory data store widely used for caching and high-performance applications. 🔹 What I practiced today ✔ Understanding Redis Redis is an in-memory key-value database that stores data in RAM, making it extremely fast compared to traditional databases. ✔ Basic Redis Commands I explored some commonly used Redis commands: Set value SET user:1 "Akash" Get value GET user:1 Delete key DEL user:1 Check all keys KEYS * ✔ Working with Data Structures Redis supports multiple data types: • Strings → Simple key-value pairs • Lists → Ordered collection • Sets → Unique values • Hashes → Key-value pairs inside a key Example: HSET user:1 name "Akash" email "akash@gmail.com" HGETALL user:1 🔹 What I learned • Redis works as a NoSQL database • Data is stored in memory for ultra-fast access • Supports multiple data structures • Used in caching, session management, and real-time systems 🔹 Why Redis is important ✔ High performance (low latency) ✔ Reduces database load ✔ Supports scalable backend systems ✔ Widely used in real-world applications 🔹 Key takeaway Redis is not just a cache—it’s a powerful in-memory data store that plays a critical role in building fast and scalable backend systems. 📌 Next step: Implement Redis caching in real APIs and explore advanced features. #Java #SpringBoot #Redis #BackendDevelopment #Caching #SoftwareEngineering #LearningInPublic #JavaDeveloper #100DaysOfCode
Redis Basics for Java Backend Development
More Relevant Posts
-
I'm currently working on updating my examples to measure the performance of the #AWS Lambda function using #Java runtime (the managed version, like 25 or deployed as a GraalVM Native Image as AWS Custom Runtime) and Spring Boot 4. I started with providing the examples using AWS #Serverless Java Container for Spring Boot 4. See my GitHub repo 👉 https://lnkd.in/eKafFg7p I previously always used NoSQL Amazon #DynamoDB in my examples, and now I would like to add some examples of using the relational Amazon Aurora DSQL database to compare the results. For this, I use a simple application to store and retrieve products. You can already see some working examples below (others will be added later). Lambda cold and warm start measurements and optimization techniques (Lambda SnapStart with primings) will be published in my upcoming articles. AWS Lambda with Managed Java 25, Spring Boot 4, AWS Serverless Java Container for Spring Boot 4 : 1) With DynamoDB 👉 https://lnkd.in/eg-FMF4R 2) With Spring JPA (Hibernate as provider), Hikari CP and Aurora DSQL 👉 https://lnkd.in/e7zbh3QQ AWS Lambda as a Custom Runtime containing GraalVM Native Image built with 25.0.2 version, Spring Boot 4, AWS Serverless Java Container for Spring Boot 4 : 1) With DynamoDB 👉 https://lnkd.in/ex5wJJMQ 2) With Spring JPA (Hibernate as provider), Hikari CP and Aurora DSQL 👉 https://lnkd.in/eTW6JUZH If you like my content, please follow me on GitHub (github.com/Vadym79) and give my repositories a star! Please also check out my website vkazulkin.com for more technical content and upcoming public speaking activities. Maximilian Schellhorn Andrei Shakirin Lefteris Karageorgiou Matt Meckes Yuriy Bezsonov Marc Bowes Raluca Constantin Philipp Page James Ward Amazon Web Services (AWS) Oracle #Hibernate #PostgreSQL #AuroraDSQL #Spring #SpringBoot
To view or add a comment, sign in
-
-
When Redis Returns LinkedHashMap Instead of Your Object — A Subtle Serialization Trap While implementing caching with Redis in a Spring Boot application using Java, I encountered an interesting issue that can easily slip into production systems. #Problem #Statement I cached a structure like this: Map<String, List<CustomObject>> The cache write worked perfectly. But when reading the value back from Redis, instead of getting: List<CustomObject> received List<LinkedHashMap> Which means every CustomObject was suddenly a LinkedHashMap. This becomes painful when downstream code expects domain objects and you start seeing ClassCastException or manual conversions everywhere. The Real Reason (Under the Hood) Most Spring Redis setups use JSON serialization (Jackson). During caching: 1. CustomObject → serialized into JSON 2. Redis simply stores the JSON payload Example stored JSON: { "key": [ { "id": 1, "name": "example" } ] } Now during deserialization, the serializer faces a limitation: **Generic type information is not preserved Because of Java Type Erasure, the serializer only knows it is reading a: List<Object> So Jackson safely converts JSON objects into its default structure: JSON Object → LinkedHashMap JSON Array → ArrayList Hence you get: List<LinkedHashMap> instead of List<CustomObject> #How to #Fix It A few practical solutions: *Configure serializer with explicit type: Jackson2JsonRedisSerializer<CustomObject> Enable type metadata in ObjectMapper *Convert manually when retrieving objectMapper.convertValue(list, new TypeReference<List<CustomObject>>() {}); Avoid storing raw generic objects in cache 💡 Takeaway Caching is easy. Correct deserialization is the tricky part. Whenever you cache generic collections, ensure that type metadata survives serialization — otherwise Java will politely give you a LinkedHashMap instead of your domain object. A small configuration detail… that can save hours of debugging in distributed systems. Curious — has anyone else hit this LinkedHashMap surprise while using Redis caching? #Redis #Java #SpringBoot #Caching #BackendEngineering #SoftwareArchitecture #SystemDesign
To view or add a comment, sign in
-
-
New blog post alert 🚨 "Serverless applications on AWS with Lambda using Java 25, API Gateway and Aurora DSQL – Part 1 Sample applications". In this article series, we’ll explain how to implement a serverless application on AWS using Lambda with the support of the released Java 25 version. One application uses JDBC and another Hibernate, both with Aurora DSQL. If you like my content, please follow me on GitHub (github.com/Vadym79) and give my repositories like this https://lnkd.in/epud2eRf a star! Maximilian Schellhorn Andrei Shakirin Lefteris Karageorgiou Matt Meckes Yuriy Bezsonov Raluca Constantin Philipp Page James Ward Amazon Web Services (AWS) Oracle #Java #Serverless #AuroraDSQL #PostgreSQL https://lnkd.in/eMSzrJGy
To view or add a comment, sign in
-
JavaTip #7 – Why Caching Matters in Backend Systems (Redis with Java) One common challenge in backend systems is handling repeated database calls for frequently accessed data. For example: Product details, user profiles, configuration data, or frequently accessed reports. If every request directly hits the database, it can quickly become a performance bottleneck as traffic grows. This is where caching comes into the picture. In many Java-based applications, Redis is commonly used as a caching layer between the application and the database. Instead of fetching the same data repeatedly from the database, the application first checks the cache. Typical flow looks like this: 1️⃣ Client request comes to the service 2️⃣ Service checks Redis cache 3️⃣ If data exists → return from cache 4️⃣ If not → fetch from database and store in cache Benefits of caching: 🔹 Faster response times Data retrieval from memory is significantly faster than database queries. 🔹 Reduced database load Caching reduces the number of repeated queries hitting the database. 🔹 Improved scalability Applications can handle more traffic without increasing database pressure. In Spring Boot applications, Redis caching can be easily implemented using annotations like @Cacheable, @CachePut, and @CacheEvict. However, caching should be used carefully. Cache invalidation, expiration strategies, and consistency with the database must be designed properly. A good backend engineer not only focuses on writing working code but also thinks about performance and scalability. #JavaTip #Java #SpringBoot #Redis #Caching #BackendDevelopment #SoftwareEngineering #OpenToWork :::
To view or add a comment, sign in
-
🚀 Day 23 – Java Backend Journey | Caching getUserById API Today I practiced applying Redis caching to a real API, specifically the getUserById endpoint, to improve performance and reduce database load. 🔹 What I practiced today I implemented caching for the GET API: GET /users/{id} This API fetches a user by ID from the database. 🔹 Caching Implementation Used Spring Boot caching with @Cacheable: 🔹 How it works • First request → Cache miss → Data fetched from DB → Stored in Redis • Next requests → Cache hit → Data returned from cache (no DB call) 🔹 What I observed ✔ Reduced database queries ✔ Faster response time ✔ Improved performance for repeated requests 🔹 Why this is important Caching frequently accessed APIs like getUserById is a common optimization technique used in real-world backend systems. It helps in: • Scaling applications • Handling high traffic • Improving user experience 🔹 Key takeaway Adding caching to APIs is a simple but powerful way to make backend systems efficient and high-performing, especially for read-heavy operations. 📌 Next step: Implement cache eviction using @CacheEvict to handle data updates. #Java #SpringBoot #Redis #Caching #BackendDevelopment #SoftwareEngineering #LearningInPublic #JavaDeveloper #100DaysOfCode
To view or add a comment, sign in
-
-
𝗢𝘃𝗲𝗿 𝘁𝗵𝗲 𝗽𝗮𝘀𝘁 𝗳𝗲𝘄 𝗱𝗮𝘆𝘀, 𝗜 𝗯𝘂𝗶𝗹𝘁 𝗦𝗽𝗿𝗶𝗻𝗴𝗕𝗼𝗼𝘁-𝗔𝗣𝗜, 𝗮 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝗽𝗿𝗼𝗷𝗲𝗰𝘁 𝗳𝗼𝗰𝘂𝘀𝗲𝗱 𝗼𝗻 𝗱𝗲𝘀𝗶𝗴𝗻𝗶𝗻𝗴 𝗽𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻-𝗿𝗲𝗮𝗱𝘆 𝗥𝗘𝗦𝗧 𝗔𝗣𝗜𝘀 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮 𝗮𝗻𝗱 𝗦𝗽𝗿𝗶𝗻𝗴 𝗕𝗼𝗼𝘁. After working with the PERN stack, I wanted to go deeper into backend engineering with Java + Spring Boot and learn how production-style APIs are typically designed (security, caching, scalability, and clean architecture). 𝗪𝗵𝗮𝘁 𝗜 𝗶𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁𝗲𝗱: • JWT Authentication + Refresh Token flow (refresh token via HTTP-only cookie + stored with TTL in Redis). • Role-based access control (USER / ADMIN protected routes). • Validation for request/data integrity (required fields + controller-level validation). • Rate limiting using Bucket4j to protect endpoints from abuse. • Redis caching using Spring Cache annotations to improve performance. • Pagination + sorting + filtering for scalable endpoints. • Dockerized setup with Docker Compose so the full stack (Spring Boot + PostgreSQL + Redis) runs locally with one command. This project helped me understand how Spring applications are structured, and how backend concerns like security + performance fit together. Github Link: https://lnkd.in/gsPY9vpk #SpringBoot #Java #BackendDevelopment #MERN #RESTAPI #PostgreSQL #Redis #Docker #DockerCompose #JWT #SoftwareEngineering #CollegeProjects #LearningByBuilding
To view or add a comment, sign in
-
-
New blog post alert 🚨 "Serverless applications on AWS with Lambda using Java 25, API Gateway and DynamoDB – Part 1 Sample application". In this article series, we’ll explain how to implement a serverless application on AWS using Lambda with the support of the released Java 25 version. If you like my content, please follow me on GitHub (github.com/Vadym79) and give my repositories like this https://lnkd.in/epud2eRf a star! Maximilian Schellhorn Andrei Shakirin Lefteris Karageorgiou Matt Meckes Yuriy Bezsonov Raluca Constantin Philipp Page James Ward Amazon Web Services (AWS) Oracle #Java #Serverless https://lnkd.in/eAwyKCQq
To view or add a comment, sign in
-
🔥 Day 1 of System Design Series — URL Shortener 👉 Problem Statement Design a system like Bitly that converts long URLs into short links Convert long URLs → short links Example: amazon.com/product/... → bit.ly/abc123 👉 Key Requirements - Generate short URL - Redirect to original - High availability & low latency 👉 High-Level Design - API Layer - Application Server - Database (mapping) - Cache (Redis) 👉 Deep Insights - Base62 encoding for short keys - Handle collisions - Cache popular URLs 👉 Tech Stack Java + Spring Boot + Redis + MySQL 👉 Challenges - Scaling to billions of requests - Preventing abuse - Optimizing read-heavy traffic 👉 Final Thought “Simple systems become complex at scale.” #SystemDesign #Java #Backend #InterviewPrep #LearningInPublic
To view or add a comment, sign in
-
New blog post alert 🚨 "Serverless applications on AWS using Lambda with Java 25, API Gateway and Aurora DSQL – Part 2 Initial performance measurements". In this article, we’ll perform Lambda function initial performance measurements of the sample application using Lambda with Java 25 API Gateway and Aurora DSQL without any optimizations. If you like my content, please follow me on GitHub (github.com/Vadym79) and give my repositories like this https://lnkd.in/epud2eRf a star! Amazon Web Services (AWS) Oracle #Java #Serverless #PostgreSQL https://lnkd.in/grbkixBZ
To view or add a comment, sign in
-
🚀 Day 22 – Java Backend Journey | Cache-Aside Pattern Today I explored the Cache-Aside pattern, one of the most commonly used caching strategies in backend systems. 🔹 What I practiced today I learned how applications use Redis cache along with a database to improve performance using the Cache-Aside approach. 🔹 What is Cache-Aside? Cache-Aside (also called Lazy Loading) means: 👉 The application checks the cache first 👉 If data is not found (cache miss), it fetches from the database 👉 Then stores the data in cache for future use 🔹 Flow of Cache-Aside Pattern 1️⃣ Request comes for data 2️⃣ Check Redis cache 3️⃣ If data exists → return from cache (fast) 4️⃣ If not → fetch from DB 5️⃣ Store result in cache 6️⃣ Return response 🔹 Example (Spring Boot) @Cacheable("users") public User getUserById(Long id) { return userRepository.findById(id) .orElseThrow(() -> new RuntimeException("User not found")); } Here: First call → DB hit + cache store Next calls → served directly from cache 🔹 What I learned • Difference between cache hit vs cache miss • How Cache-Aside reduces database load • Improves response time significantly • Commonly used in real-world backend systems 🔹 Advantages ✔ Simple and easy to implement ✔ Efficient for read-heavy applications ✔ Reduces unnecessary database queries 🔹 Challenges • Cache inconsistency if data is updated • Need proper cache eviction strategy • Handling stale data 🔹 Key takeaway The Cache-Aside pattern is a fundamental caching strategy that helps build high-performance and scalable backend applications. 📌 Next step: Learn cache eviction and cache update strategies (TTL, @CacheEvict). #Java #SpringBoot #Redis #Caching #BackendDevelopment #SoftwareEngineering #LearningInPublic #JavaDeveloper #100DaysOfCode
To view or add a comment, sign in
-