taoensso / carmine

Redis client + message queue for Clojure
https://www.taoensso.com/carmine
Eclipse Public License 1.0
1.15k stars 130 forks source link

How to use MAXLEN with streams XADD? #258

Closed glenthomas closed 2 years ago

glenthomas commented 2 years ago

Hello,

I am trying to use the MAXLEN option with xadd but can't figure out the correct syntax.

My xadd works:

(car/xadd stream-name "*" data-map)

Could somebody please provide a small code sample for adding MAXLEN, with ~ also, to this? Thanks.

ptaoussanis commented 2 years ago

Hi Glen!

Carmine's API is just a thin wrapper around the underlying Redis API. So just checking: have you seen the Redis documentation for this?

Also any general Redis examples you find online should in principle be directly applicable to Carmine.

Hope that's at least some help in the meantime! Cheers :-)

Edit to add in case it's helpful: you can use Clojure strings to act as any special Redis arguments (e.g. "MAXLEN", "~", etc.)

glenthomas commented 2 years ago

Hello Peter,

Yes I have tried code like this, but I had an error (I don't have the info to share right now).

(car/xadd stream-name :MAXLEN 1000 "*" data-map)

I think I probably need to do something like this instead, so will give this a try.

(car/xadd stream-name "MAXLEN" "~" 1000 "*" data-map)

Thanks