Redis in Action: Social Features Implementation This section covers the implementation of common social features such as saving and liking posts, following/unfollowing users, finding mutual follows, and building a feed push system, all leveraging Redis for performance. User Check-ins and Posts Uploa...
RedisTemplate provides methods to set expiration times for keys using TTL (Time To Live). However, operations like expire may not immediately reflect the expected TTL due to asynchronous execution or timing issues. To address this, ensure atomicity by wrapping TTL settings within a transaction using...
Technology Stack and Core FrameworksThe foundation of a robust flash sale system relies on Spring Boot for rapid development, Thymeleaf for server-side rendering (if not fully decoupled), MyBatis for ORM, and MySQL with Druid connection pooling. Caching and distributed sessions are handled via Redis...
Spring Session offers extensive customization options for Redis-backed HTTP sessions. This article explores key configuration aspects including serialization strategies, namespace management, repository selection, and event handling mechanisms. JSON Serialization Configuration By default, Spring Ses...
Redis replication enables a distributed data architecture where one node acts as the authoritative primary (master) for all write operations, while one or more replica (slave) nodes handle read requests. This separation improves scalability, fault tolerance, and operational safety. Core Principles W...
1. Configuration Setup Import the required dependency in your pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency> Configure cache settings in application.yml: spring: cache: type: redis...
Redis provides three specialized data structures optimized for specific use cases: Structure Use Case Bitmaps Space-efficient storage for binary state tracking (daily/monthly user check-ins) HyperLogLog Approximate cardinality estimation for massive datasets (UV counting) GEO Geospatial data storage...
1. Compile and Install Redis from Source Navigate to the target directory and retrieve the source archive. This example uses /opt for third-party sofwtare management. cd /opt sudo curl -L https://github.com/redis/redis/archive/refs/tags/7.2.5.tar.gz -o redis-src.tar.gz sudo tar -xzf redis-src.tar.gz...
For large-scale systems handling user online status, UUIDs are often used as unique identifiers. To manage this data efficiently with Redis, consider the following architectural approaches. 1. Using Redis Hashes (Hashes) Using full UUID strings as direct keys can be inefficient. A better method is t...
Folllowing the establishment of the Redis connection pool and population of preliminary test records, the development cycle shifts toward automating credential management. An initialization routine automatically retrieves stored usernames and passwords to pre-fill authentication fields, eliminating...