Answer the question
In order to leave comments, you need to log in
How to organize caching with redis?
Please help me understand if I understand the organization of CRUD for non-critical data using redis. CREATE
operation :
начало транзакции
запись в postgres
запись в redis
конец транзакции
читать из redis
если не прочиталось из redis, то:
читать из postgres
начало транзакции
обновить в redis
обновить в postgres
конец транзакции
начало транзакции
удалить в redis
удалить в postgres
конец транзакции
Answer the question
In order to leave comments, you need to log in
No, you're all wrong! First, you DO NOT have a transaction on both postgres and radish at the same time, and this is the key point. Secondly, always do all updates in postgres with the key removed from the radish. Reading - first we read from the radish, and if not there, we climb into postgres and write the key to the radish.
And yes, if the data is not critical, such as counters, baskets, etc., then they can be stored in a radish.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question