MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / streamTrimByLength

Function streamTrimByLength

src/t_stream.cpp:869–876  ·  view source on GitHub ↗

Trims a stream by length. Returns the number of deleted items. */

Source from the content-addressed store, hash-verified

867
868/* Trims a stream by length. Returns the number of deleted items. */
869int64_t streamTrimByLength(stream *s, long long maxlen, int approx) {
870 streamAddTrimArgs args = {{0}};
871 args.trim_strategy = TRIM_STRATEGY_MAXLEN;
872 args.approx_trim = approx;
873 args.limit = approx ? 100 * g_pserver->stream_node_max_entries : 0;
874 args.maxlen = maxlen;
875 return streamTrim(s, &args);
876}
877
878/* Trims a stream by minimum ID. Returns the number of deleted items. */
879int64_t streamTrimByID(stream *s, streamID minid, int approx) {

Callers 1

RM_StreamTrimByLengthFunction · 0.85

Calls 1

streamTrimFunction · 0.85

Tested by

no test coverage detected