11 Kasım 2021 Perşembe

Redis - List Veri Yapısı

Giriş
List komutları burada
- B harfi ile başlayanlar blocking. 
- BL ile başlayanlar, listenin ilk elemanı içindir.
- BR ile başlayanlar listenin son elemanı içindir

Şeklen şöyle. Burada LPUSH, RPOP, DEL görülebilir.


LPUSH
Listenin başına eleman ekler
Örnek
Şöyle yaparız
LPUSH myset 123
LPUSH myset "123"

RPOPLPUSH - Reliable Queue

İlk listenin son elemanını pop ederken, ikinci liste'nin önüne push eder. Açıklaması şöyle
Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.

For example: consider source holding the list a,b,c, and destination holding the list x,y,z. Executing RPOPLPUSH results in source holding a,b and destination holding c,x,y,z.
Açıklaması şöyle
Lists : they allow us to adopt a worker-queue based approach which can distribute load among worker apps. the messages are removed once they are consumed. it can provide some level of fault-tolerance and reliability using RPOPLPUSH (and BRPOPLPUSH)

Hiç yorum yok:

Yorum Gönder