Em có 1 api gồm các param như idItem , idUser , page , size . Cho em hỏi nên lưu key trên redis như nào để tối ưu hóa số lương key , thường sẽ lưu key cache như nào nếu nhiều param ạ.
Em cảm ơn
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Anh chưa hiểu các trường
idItem , idUser , page , size
có mỗi liên hệ gì với nhau nhưng anh đoán là em đang làm phân trang dữ liệu, và redis chuyên dành cho key value (kiểu hash map), mặc dù nó cũng có kiểu sorted map tuy nhiên cần hạn chế sử dụng để tiết kiệm bộ nhớ nên phân trang em nên dùng DB thay vì redis em ạ2. Trên redis em nên dạng Hmap để tiết kiệm key em ạ, kiểu này:
Chứ không nên lưu kiểu:
3. Em có thể tham khảo câu trả lời từ câu hỏi trước đó nhé.