|
15 | 15 | */
|
16 | 16 |
|
17 | 17 | package zio.redis.api
|
18 |
| - |
19 | 18 | import zio._
|
20 | 19 | import zio.redis.Input._
|
21 | 20 | import zio.redis.Output._
|
@@ -1027,51 +1026,51 @@ trait Streams[G[+_]] extends RedisEnvironment[G] {
|
1027 | 1026 | *
|
1028 | 1027 | * @param key
|
1029 | 1028 | * ID of the stream
|
1030 |
| - * @param count |
1031 |
| - * stream length |
| 1029 | + * @param threshold |
| 1030 | + * Evicts entries as long as the stream's length exceeds the specified threshold |
1032 | 1031 | * @param approximate
|
1033 | 1032 | * flag that indicates if the stream length should be exactly count or few tens of entries more
|
1034 | 1033 | * @return
|
1035 | 1034 | * the number of entries deleted from the stream.
|
1036 | 1035 | */
|
1037 | 1036 | final def xTrimWithMaxLen[SK: Schema](
|
1038 | 1037 | key: SK,
|
1039 |
| - count: Long, |
| 1038 | + threshold: Long, |
1040 | 1039 | approximate: Boolean = false,
|
1041 | 1040 | limit: Option[Long] = None
|
1042 | 1041 | ): G[Long] =
|
1043 | 1042 | if (approximate) {
|
1044 | 1043 | val command = RedisCommand(XTrim, Tuple2(ArbitraryKeyInput[SK](), MaxLenApproxInput), LongOutput)
|
1045 |
| - command.run((key, CappedStreamType.MaxLenApprox(count, limit))) |
| 1044 | + command.run((key, CappedStreamType.MaxLenApprox(threshold, limit))) |
1046 | 1045 | } else {
|
1047 | 1046 | val command = RedisCommand(XTrim, Tuple2(ArbitraryKeyInput[SK](), MaxLenExactInput), LongOutput)
|
1048 |
| - command.run((key, CappedStreamType.MaxLenExact(count))) |
| 1047 | + command.run((key, CappedStreamType.MaxLenExact(threshold))) |
1049 | 1048 | }
|
1050 | 1049 |
|
1051 | 1050 | /**
|
1052 | 1051 | * Trims the stream to a given number of items, evicting older items (items with lower IDs) if needed.
|
1053 | 1052 | *
|
1054 | 1053 | * @param key
|
1055 | 1054 | * ID of the stream
|
1056 |
| - * @param minId |
1057 |
| - * minimal stream id |
| 1055 | + * @param threshold |
| 1056 | + * Evicts entries with IDs lower than threshold, where threshold is a stream ID |
1058 | 1057 | * @param approximate
|
1059 | 1058 | * flag that indicates if the stream length should be exactly count or few tens of entries more
|
1060 | 1059 | * @return
|
1061 | 1060 | * the number of entries deleted from the stream.
|
1062 | 1061 | */
|
1063 | 1062 | final def xTrimWithMinId[SK: Schema, I: Schema](
|
1064 | 1063 | key: SK,
|
1065 |
| - minId: I, |
| 1064 | + threshold: I, |
1066 | 1065 | approximate: Boolean = false,
|
1067 | 1066 | limit: Option[Long] = None
|
1068 | 1067 | ): G[Long] =
|
1069 | 1068 | if (approximate) {
|
1070 | 1069 | val command = RedisCommand(XTrim, Tuple2(ArbitraryKeyInput[SK](), MinIdApproxInput[I]()), LongOutput)
|
1071 |
| - command.run((key, CappedStreamType.MinIdApprox(minId, limit))) |
| 1070 | + command.run((key, CappedStreamType.MinIdApprox(threshold, limit))) |
1072 | 1071 | } else {
|
1073 | 1072 | val command = RedisCommand(XTrim, Tuple2(ArbitraryKeyInput[SK](), MinIdExactInput[I]()), LongOutput)
|
1074 |
| - command.run((key, CappedStreamType.MinIdExact(minId))) |
| 1073 | + command.run((key, CappedStreamType.MinIdExact(threshold))) |
1075 | 1074 | }
|
1076 | 1075 | }
|
1077 | 1076 |
|
|
0 commit comments