En Redis existe ZSET y script Lua para ejecucion de metodos/transacciones atomica.
1. un ZSET es más parecido a:
Map<String, Long>
+
TreeMap<Long, Set<String>>
2. El script se ejecuta con Redis:
docker run -d \
--name redis-poc \
-p 6379:6379 \
redis:7
3. El output esperado:
=== INITIAL BALANCES ===
ACCOUNT_A = 1000
ACCOUNT_B = 500
=== LUA RESULT ===
SUCCESS
1000
900
500
600
=== FINAL BALANCES ===
ACCOUNT_A = 900
ACCOUNT_B = 600
=== MODIFIED ACCOUNTS ===
ACCOUNT_A
ACCOUNT_B
4. Codigo fuente:
No comments :
Post a Comment