-
Notifications
You must be signed in to change notification settings - Fork 946
/
RedisScriptingReactiveCommands.java
174 lines (158 loc) · 5.15 KB
/
RedisScriptingReactiveCommands.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
* Copyright 2017-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.lettuce.core.api.reactive;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import io.lettuce.core.FlushMode;
import io.lettuce.core.ScriptOutputType;
/**
* Reactive executed commands for Scripting. {@link java.lang.String Lua scripts} are encoded by using the configured
* {@link io.lettuce.core.ClientOptions#getScriptCharset() charset}.
*
* @param <K> Key type.
* @param <V> Value type.
* @author Mark Paluch
* @since 4.0
* @generated by io.lettuce.apigenerator.CreateReactiveApi
*/
public interface RedisScriptingReactiveCommands<K, V> {
/**
* Execute a Lua script server side.
*
* @param script Lua 5.1 script.
* @param type output type.
* @param keys key names.
* @param <T> expected return type.
* @return script result.
*/
<T> Flux<T> eval(String script, ScriptOutputType type, K... keys);
/**
* Execute a Lua script server side.
*
* @param script Lua 5.1 script.
* @param type output type.
* @param keys key names.
* @param <T> expected return type.
* @return script result.
* @since 6.0
*/
<T> Flux<T> eval(byte[] script, ScriptOutputType type, K... keys);
/**
* Execute a Lua script server side.
*
* @param script Lua 5.1 script.
* @param type the type.
* @param keys the keys.
* @param values the values.
* @param <T> expected return type.
* @return script result.
*/
<T> Flux<T> eval(String script, ScriptOutputType type, K[] keys, V... values);
/**
* Execute a Lua script server side.
*
* @param script Lua 5.1 script.
* @param type the type.
* @param keys the keys.
* @param values the values.
* @param <T> expected return type.
* @return script result.
* @since 6.0
*/
<T> Flux<T> eval(byte[] script, ScriptOutputType type, K[] keys, V... values);
/**
* Evaluates a script cached on the server side by its SHA1 digest.
*
* @param digest SHA1 of the script.
* @param type the type.
* @param keys the keys.
* @param <T> expected return type.
* @return script result.
*/
<T> Flux<T> evalsha(String digest, ScriptOutputType type, K... keys);
/**
* Execute a Lua script server side.
*
* @param digest SHA1 of the script.
* @param type the type.
* @param keys the keys.
* @param values the values.
* @param <T> expected return type.
* @return script result.
*/
<T> Flux<T> evalsha(String digest, ScriptOutputType type, K[] keys, V... values);
/**
* Check existence of scripts in the script cache.
*
* @param digests script digests.
* @return Boolean array-reply The command returns an array of integers that correspond to the specified SHA1
* digest arguments. For every corresponding SHA1 digest of a script that actually exists in the script cache, an 1
* is returned, otherwise 0 is returned.
*/
Flux<Boolean> scriptExists(String... digests);
/**
* Remove all the scripts from the script cache.
*
* @return String simple-string-reply.
*/
Mono<String> scriptFlush();
/**
* Remove all the scripts from the script cache using the specified {@link FlushMode}.
*
* @param flushMode the flush mode (sync/async).
* @return String simple-string-reply.
* @since 6.1
*/
Mono<String> scriptFlush(FlushMode flushMode);
/**
* Kill the script currently in execution.
*
* @return String simple-string-reply.
*/
Mono<String> scriptKill();
/**
* Load the specified Lua script into the script cache.
*
* @param script script content.
* @return String bulk-string-reply This command returns the SHA1 digest of the script added into the script cache.
* @since 6.0
*/
Mono<String> scriptLoad(String script);
/**
* Load the specified Lua script into the script cache.
*
* @param script script content.
* @return String bulk-string-reply This command returns the SHA1 digest of the script added into the script cache.
* @since 6.0
*/
Mono<String> scriptLoad(byte[] script);
/**
* Create a SHA1 digest from a Lua script.
*
* @param script script content.
* @return the SHA1 value.
* @since 6.0
*/
String digest(String script);
/**
* Create a SHA1 digest from a Lua script.
*
* @param script script content.
* @return the SHA1 value.
* @since 6.0
*/
String digest(byte[] script);
}