glide_shared
ALL_CHANNELS = None
module-attribute
Constant representing 'unsubscribe from all channels'. Pass this to unsubscribe() to unsubscribe from all channels.
ALL_PATTERNS = None
module-attribute
Constant representing 'unsubscribe from all patterns'. Pass this to punsubscribe() to unsubscribe from all patterns.
ALL_SHARDED_CHANNELS = None
module-attribute
Constant representing 'unsubscribe from all sharded channels'. Pass this to sunsubscribe() to unsubscribe from all sharded channels.
Batch
Bases: BaseBatch
Batch implementation for standalone GlideClient. Batches allow the execution of a group of commands in a single step.
Batch Response
An array of command responses is returned by the client exec command,
in the order they were given. Each element in the array represents a command given to the Batch.
The response for each command depends on the executed Valkey command.
Specific response types are documented alongside each method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_atomic
|
bool
|
Determines whether the batch is atomic or non-atomic. If |
required |
See Valkey Transactions (Atomic Batches) and Valkey Pipelines (Non-Atomic Batches) for details.
Note for Standalone Mode (Cluster Mode Disabled): Standalone Batches are executed on the primary node.
Examples:
Atomic Batch - Transaction:
>>> transaction = Batch(is_atomic=True) # Atomic (Transaction)
>>> transaction.set("key", "value")
>>> transaction.get("key")
>>> result = await client.exec(transaction, false)
>>> print(result)
[OK, b"value"]
Non-Atomic Batch - Pipeline:
>>> pipeline = Batch(is_atomic=False) # Non-Atomic (Pipeline)
>>> pipeline.set("key1", "value1")
>>> pipeline.set("key2", "value2")
>>> pipeline.get("key1")
>>> pipeline.get("key2")
>>> result = await client.exec(pipeline, false)
>>> print(result)
[OK, OK, b"value1", b"value2"]
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 | |
select(index)
Change the currently selected database.
See valkey.io for details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
The index of the database to select. |
required |
Command response
A simple OK response.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 | |
copy(source, destination, destinationDB=None, replace=None)
Copies the value stored at the source to the destination key. If destinationDB
is specified, the value will be copied to the database specified by destinationDB,
otherwise the current database will be used. When replace is True, removes the
destination key first if it already exists, otherwise performs no action.
See valkey.io for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
TEncodable
|
The key to the source value. |
required |
destination
|
TEncodable
|
The key where the value should be copied to. |
required |
destinationDB
|
Optional[int]
|
The alternative logical database index for the destination key. |
None
|
replace
|
Optional[bool]
|
If the destination key should be removed before copying the value to it. |
None
|
Command response
bool: True if the source was copied.
Otherwise, return False.
Since: Valkey version 6.2.0.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 | |
publish(message, channel)
Publish a message on pubsub channel.
See valkey.io for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
TEncodable
|
Message to publish |
required |
channel
|
TEncodable
|
Channel to publish the message on. |
required |
Command Respose
int: Number of subscriptions in that shard that received the message.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 | |
ClusterBatch
Bases: BaseBatch
Batch implementation for cluster GlideClusterClient. Batches allow the execution of a group of commands in a single step.
Batch Response
An array of command responses is returned by the client exec command,
in the order they were given. Each element in the array represents a command given to the ClusterBatch.
The response for each command depends on the executed Valkey command.
Specific response types are documented alongside each method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_atomic
|
bool
|
Determines whether the batch is atomic or non-atomic. If |
required |
See Valkey Transactions (Atomic Batches) and Valkey Pipelines (Non-Atomic Batches) for details.
Examples:
Atomic Batch - Transaction in a Cluster:
>>> transaction = ClusterBatch(is_atomic=True) # Atomic (Transaction)
>>> transaction.set("key", "value")
>>> transaction.get("key")
>>> result = await client.exec(transaction, false)
>>> print(result)
[OK, b"value"]
Non-Atomic Batch - Pipeline in a Cluster:
>>> pipeline = ClusterBatch(is_atomic=False) # Non-Atomic (Pipeline)
>>> pipeline.set("key1", "value1")
>>> pipeline.set("key2", "value2")
>>> pipeline.get("key1")
>>> pipeline.get("key2")
>>> result = await client.exec(pipeline, false)
>>> print(result)
[OK, OK, b"value1", b"value2"]
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 | |
copy(source, destination, replace=None, destinationDB=None)
Copies the value stored at the source to the destination key. When replace is True,
removes the destination key first if it already exists, otherwise performs no action.
See valkey.io for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
TEncodable
|
The key to the source value. |
required |
destination
|
TEncodable
|
The key where the value should be copied to. |
required |
replace
|
Optional[bool]
|
If the destination key should be removed before copying the value to it. |
None
|
destinationDB
|
Optional[int]
|
The alternative logical database index for the destination key. |
None
|
Command response: bool: True if the source was copied.
Otherwise, return False.
Since: Valkey version 9.0.0.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 | |
publish(message, channel, sharded=False)
Publish a message on pubsub channel. This command aggregates PUBLISH and SPUBLISH commands functionalities. The mode is selected using the 'sharded' parameter
See PUBLISH and SPUBLISH for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Message to publish |
required |
channel
|
str
|
Channel to publish the message on. |
required |
sharded
|
bool
|
Use sharded pubsub mode. Available since Valkey version 7.0. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
ClusterBatch
|
Number of subscriptions in that shard that received the message. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 | |
pubsub_shardchannels(pattern=None)
Lists the currently active shard channels.
See valkey.io for details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
Optional[TEncodable]
|
A glob-style pattern to match active shard channels. If not provided, all active shard channels are returned. |
None
|
Command response
List[bytes]: A list of currently active shard channels matching the given pattern.
If no pattern is specified, all active shard channels are returned.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 | |
pubsub_shardnumsub(channels=None)
Returns the number of subscribers (exclusive of clients subscribed to patterns) for the specified shard channels.
Note
It is valid to call this command without channels. In this case, it will just return an empty map.
See valkey.io for details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channels
|
Optional[List[str]]
|
The list of shard channels to query for the number of subscribers. If not provided, returns an empty map. |
None
|
Command response
Mapping[bytes, int]: A map where keys are the shard channel names and values are the number of subscribers.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch.py
5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 | |
BatchOptions
Bases: BaseBatchOptions
Options for a batch request for a standalone client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Optional[int]
|
The duration in milliseconds that the client should wait for the batch request to complete. This duration encompasses sending the request, awaiting a response from the server, and any required reconnections or retries. If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, the client's default request timeout will be used. |
None
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch_options.py
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 | |
BatchRetryStrategy
Defines a retry strategy for cluster batch requests, allowing control over retries in case of server or connection errors.
This strategy determines whether failed commands should be retried, impacting execution order and potential side effects.
Behavior
- If
retry_server_errorisTrue, failed commands with a retriable error (e.g.,TRYAGAIN) will be retried. - If
retry_connection_errorisTrue, batch requests will be retried on connection failures.
Cautions
- Server Errors: Retrying may cause commands targeting the same slot to be executed out of order.
- Connection Errors: Retrying may lead to duplicate executions, since the server might have already received and processed the request before the error occurred.
Example Scenario
MGET key {key}:1
SET key "value"
Expected response when keys are empty:
[None, None]
"OK"
However, if the slot is migrating, both commands may return an ASK error and be
redirected. Upon ASK redirection, a multi-key command may return a TRYAGAIN
error (triggering a retry), while the SET command succeeds immediately. This
can result in an unintended reordering of commands if the first command is retried
after the slot stabilizes:
["value", None]
"OK"
Note
Currently, retry strategies are supported only for non-atomic batches.
Default
Both retry_server_error and retry_connection_error are set to False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
retry_server_error
|
bool
|
If ⚠️ Warning: Enabling this flag may cause commands targeting the same slot to execute out of order. By default, this is set to |
False
|
retry_connection_error
|
bool
|
If ⚠️ Warning: Retrying after a connection error may lead to duplicate executions, since the server might have already received and processed the request before the error occurred. By default, this is set to |
False
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch_options.py
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 | |
ClusterBatchOptions
Bases: BaseBatchOptions
Options for cluster batch operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Optional[int]
|
The duration in milliseconds that the client should wait for the batch request to complete. This duration encompasses sending the request, awaiting a response from the server, and any required reconnections or retries. If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, the client's default request timeout will be used. |
None
|
route
|
Optional[TSingleNodeRoute]
|
Configures single-node routing for the batch request. The client
will send the batch to the specified node defined by If a redirection error occurs:
|
None
|
retry_strategy
|
Optional[BatchRetryStrategy]
|
⚠️ Please see Defines the retry strategy for handling cluster batch request failures. This strategy determines whether failed commands should be retried, potentially impacting execution order.
Warnings:
Note: Currently, retry strategies are supported only for non-atomic batches. Recommendation: It is recommended to increase the timeout in Default: Both |
None
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/batch_options.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
BitEncoding
Bases: ABC
Abstract Base Class used to specify a signed or unsigned argument encoding for the BITFIELD or BITFIELD_RO
commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
73 74 75 76 77 78 79 80 81 82 83 84 85 | |
to_arg()
abstractmethod
Returns the encoding as a string argument to be used in the BITFIELD or BITFIELD_RO
commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
79 80 81 82 83 84 85 | |
BitFieldGet
Bases: BitFieldSubCommands
Represents the "GET" subcommand for getting a value in the binary representation of the string stored in key.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
BitEncoding
|
The bit encoding for the subcommand. |
offset |
BitFieldOffset
|
The offset in the array of bits from which to get the value. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
BitFieldIncrBy
Bases: BitFieldSubCommands
Represents the "INCRBY" subcommand for increasing or decreasing bits in the binary representation of the
string stored in key.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
BitEncoding
|
The bit encoding for the subcommand. |
offset |
BitOffset
|
The offset in the array of bits where the value will be incremented. |
increment |
int
|
The value to increment the bits in the binary value by. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
BitFieldOffset
Bases: ABC
Abstract Base Class representing an offset for an array of bits for the BITFIELD or BITFIELD_RO commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
124 125 126 127 128 129 130 131 132 133 | |
to_arg()
abstractmethod
Returns the offset as a string argument to be used in the BITFIELD or BITFIELD_RO
commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
127 128 129 130 131 132 133 | |
BitFieldOverflow
Bases: BitFieldSubCommands
Represents the "OVERFLOW" subcommand that determines the result of the "SET" or "INCRBY" BITFIELD subcommands
when an underflow or overflow occurs.
Attributes:
| Name | Type | Description |
|---|---|---|
overflow_control |
BitOverflowControl
|
The desired overflow behavior. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
BitFieldSet
Bases: BitFieldSubCommands
Represents the "SET" subcommand for setting bits in the binary representation of the string stored in key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encoding
|
BitEncoding
|
The bit encoding for the subcommand. |
required |
offset
|
BitOffset
|
The offset in the array of bits where the value will be set. |
required |
value
|
int
|
The value to set the bits in the binary value to. |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
BitFieldSubCommands
Bases: ABC
Abstract Base Class representing subcommands for the BITFIELD or BITFIELD_RO commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
179 180 181 182 183 184 185 186 187 | |
to_args()
abstractmethod
Returns the subcommand as a list of string arguments to be used in the BITFIELD or BITFIELD_RO commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
182 183 184 185 186 187 | |
BitmapIndexType
Bases: Enum
Enumeration specifying if index arguments are BYTE indexes or BIT indexes. Can be specified in OffsetOptions,
which is an optional argument to the BITCOUNT command.
Since: Valkey version 7.0.0.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
BYTE = 'BYTE'
class-attribute
instance-attribute
Specifies that indexes provided to OffsetOptions are byte indexes.
BIT = 'BIT'
class-attribute
instance-attribute
Specifies that indexes provided to OffsetOptions are bit indexes.
BitOffset
Bases: BitFieldOffset
Represents an offset in an array of bits for the BITFIELD or BITFIELD_RO commands. Must be greater than or
equal to 0.
For example, if we have the binary 01101001 with offset of 1 for an unsigned encoding of size 4, then the value
is 13 from 0(1101)001.
Attributes:
| Name | Type | Description |
|---|---|---|
offset |
int
|
The bit index offset in the array of bits. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
BitOffsetMultiplier
Bases: BitFieldOffset
Represents an offset in an array of bits for the BITFIELD or BITFIELD_RO commands. The bit offset index is
calculated as the numerical value of the offset multiplied by the encoding value. Must be greater than or equal
to 0.
For example, if we have the binary 01101001 with offset multiplier of 1 for an unsigned encoding of size 4, then
the value is 9 from 0110(1001).
Attributes:
| Name | Type | Description |
|---|---|---|
offset |
int
|
The offset in the array of bits, which will be multiplied by the encoding value to get the final bit index offset. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
BitOverflowControl
Bases: Enum
Enumeration specifying bit overflow controls for the BITFIELD command.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
WRAP = 'WRAP'
class-attribute
instance-attribute
Performs modulo when overflows occur with unsigned encoding. When overflows occur with signed encoding, the value restarts at the most negative value. When underflows occur with signed encoding, the value restarts at the most positive value.
SAT = 'SAT'
class-attribute
instance-attribute
Underflows remain set to the minimum value, and overflows remain set to the maximum value.
FAIL = 'FAIL'
class-attribute
instance-attribute
Returns None when overflows occur.
BitwiseOperation
Bases: Enum
Enumeration defining the bitwise operation to use in the BITOP command. Specifies the bitwise operation to
perform between the passed in keys.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
61 62 63 64 65 66 67 68 69 70 | |
OffsetOptions
Represents offsets specifying a string interval to analyze in the BITCOUNT command. The offsets are
zero-based indexes, with 0 being the first index of the string, 1 being the next index and so on.
The offsets can also be negative numbers indicating offsets starting at the end of the string, with -1 being
the last index of the string, -2 being the penultimate, and so on.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
int
|
The starting offset index. |
end |
Optional[int]
|
The ending offset index. Optional since Valkey version 8.0.0 and above for the BITCOUNT command. If not provided, it will default to the end of the string. |
index_type |
Optional[BitmapIndexType]
|
The index offset type. This option can only be specified if you are
using Valkey version 7.0.0 or above. Could be either |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
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 | |
SignedEncoding
Bases: BitEncoding
Represents a signed argument encoding. Must be less than 65 bits long.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding_length |
int
|
The bit size of the encoding. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
UnsignedEncoding
Bases: BitEncoding
Represents an unsigned argument encoding. Must be less than 64 bits long.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding_length |
int
|
The bit size of the encoding. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
Limit
Represents a limit argument for range queries in various commands.
The LIMIT argument is commonly used to specify a subset of results from the matching elements,
similar to the LIMIT clause in SQL (e.g., SELECT LIMIT offset, count).
This class can be utilized in multiple commands that support limit options, such as ZRANGE, SORT and others.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset
|
int
|
The starting position of the range, zero based. |
required |
count
|
int
|
The maximum number of elements to include in the range. A negative count returns all elements from the offset. |
required |
Examples:
>>> limit = Limit(0, 10) # Fetch the first 10 elements
>>> limit = Limit(5, -1) # Fetch all elements starting from the 5th element
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
ListDirection
Bases: Enum
Enumeration representing element popping or adding direction for List commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
LEFT = 'LEFT'
class-attribute
instance-attribute
LEFT: Represents the option that elements should be popped from or added to the left side of a list.
RIGHT = 'RIGHT'
class-attribute
instance-attribute
RIGHT: Represents the option that elements should be popped from or added to the right side of a list.
ObjectType
Bases: Enum
Enumeration representing the data types supported by the database.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
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 | |
STRING = 'String'
class-attribute
instance-attribute
Represents a string data type.
LIST = 'List'
class-attribute
instance-attribute
Represents a list data type.
SET = 'Set'
class-attribute
instance-attribute
Represents a set data type.
ZSET = 'ZSet'
class-attribute
instance-attribute
Represents a sorted set data type.
HASH = 'Hash'
class-attribute
instance-attribute
Represents a hash data type.
STREAM = 'Stream'
class-attribute
instance-attribute
Represents a stream data type.
OrderBy
Bases: Enum
Enumeration representing sorting order options.
This enum is used for the following commands:
- `SORT`: General sorting in ascending or descending order.
- `GEOSEARCH`: Sorting items based on their proximity to a center point.
- `FT.AGGREGATE`: Used in the SortBy clause of the FT.AGGREGATE command.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
ASC = 'ASC'
class-attribute
instance-attribute
ASC: Sort in ascending order.
DESC = 'DESC'
class-attribute
instance-attribute
DESC: Sort in descending order.
ConditionalChange
Bases: Enum
A condition to the SET, ZADD and GEOADD commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
27 28 29 30 31 32 33 34 35 36 | |
ONLY_IF_EXISTS = 'XX'
class-attribute
instance-attribute
Only update key / elements that already exist. Equivalent to XX in the Valkey API.
ONLY_IF_DOES_NOT_EXIST = 'NX'
class-attribute
instance-attribute
Only set key / add elements that does not already exist. Equivalent to NX in the Valkey API.
ExpireOptions
Bases: Enum
EXPIRE option: options for setting key expiry.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
HasNoExpiry = 'NX'
class-attribute
instance-attribute
Set expiry only when the key has no expiry (Equivalent to "NX" in Valkey).
HasExistingExpiry = 'XX'
class-attribute
instance-attribute
Set expiry only when the key has an existing expiry (Equivalent to "XX" in Valkey).
NewExpiryGreaterThanCurrent = 'GT'
class-attribute
instance-attribute
Set expiry only when the new expiry is greater than the current one (Equivalent to "GT" in Valkey).
NewExpiryLessThanCurrent = 'LT'
class-attribute
instance-attribute
Set expiry only when the new expiry is less than the current one (Equivalent to "LT" in Valkey).
ExpiryGetEx
GetEx option: Represents the expiry type and value to be executed with "GetEx" command.
Attributes:
| Name | Type | Description |
|---|---|---|
cmd_arg |
str
|
The expiry type. |
value |
str
|
The value for the expiry type. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
set_expiry_type_and_value(expiry_type, value)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expiry_type
|
ExpiryType
|
The expiry type. |
required |
value
|
Optional[Union[int, datetime, timedelta]]
|
The value of the expiration type. The type of expiration determines the type of expiration value: |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
ExpirySet
SET option: Represents the expiry type and value to be executed with "SET" command.
Attributes:
| Name | Type | Description |
|---|---|---|
cmd_arg |
str
|
The expiry type. |
value |
str
|
The value for the expiry type. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
set_expiry_type_and_value(expiry_type, value)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expiry_type
|
ExpiryType
|
The expiry type. |
required |
value
|
Optional[Union[int, datetime, timedelta]]
|
The value of the expiration type. The type of expiration determines the type of expiration value: |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
ExpiryType
Bases: Enum
SET option: The type of the expiry.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
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 | |
SEC = (0, Union[int, timedelta])
class-attribute
instance-attribute
Set the specified expire time, in seconds. Equivalent to EX in the Valkey API.
MILLSEC = (1, Union[int, timedelta])
class-attribute
instance-attribute
Set the specified expire time, in milliseconds. Equivalent to PX in the Valkey API.
UNIX_SEC = (2, Union[int, datetime])
class-attribute
instance-attribute
Set the specified Unix time at which the key will expire, in seconds. Equivalent to EXAT in the Valkey API.
UNIX_MILLSEC = (3, Union[int, datetime])
class-attribute
instance-attribute
Set the specified Unix time at which the key will expire, in milliseconds. Equivalent to PXAT in the Valkey API.
KEEP_TTL = (4, Type[None])
class-attribute
instance-attribute
Retain the time to live associated with the key. Equivalent to KEEPTTL in the Valkey API.
ExpiryTypeGetEx
Bases: Enum
GetEx option: The type of the expiry.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
SEC = (0, Union[int, timedelta])
class-attribute
instance-attribute
Set the specified expire time, in seconds. Equivalent to EX in the Valkey API.
MILLSEC = (1, Union[int, timedelta])
class-attribute
instance-attribute
Set the specified expire time, in milliseconds. Equivalent to PX in the Valkey API.
UNIX_SEC = (2, Union[int, datetime])
class-attribute
instance-attribute
Set the specified Unix time at which the key will expire, in seconds. Equivalent to EXAT in the Valkey API.
UNIX_MILLSEC = (3, Union[int, datetime])
class-attribute
instance-attribute
Set the specified Unix time at which the key will expire, in milliseconds. Equivalent to PXAT in the Valkey API.
PERSIST = (4, Type[None])
class-attribute
instance-attribute
Remove the time to live associated with the key. Equivalent to PERSIST in the Valkey API.
FlushMode
Bases: Enum
Defines flushing mode for:
FLUSHALL command and FUNCTION FLUSH command.
See FLUSHAL and FUNCTION-FLUSH for details
SYNC was introduced in version 6.2.0.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
FunctionRestorePolicy
Bases: Enum
Options for the FUNCTION RESTORE command.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
APPEND = 'APPEND'
class-attribute
instance-attribute
Appends the restored libraries to the existing libraries and aborts on collision. This is the default policy.
FLUSH = 'FLUSH'
class-attribute
instance-attribute
Deletes all existing libraries before restoring the payload.
REPLACE = 'REPLACE'
class-attribute
instance-attribute
Appends the restored libraries to the existing libraries, replacing any existing ones in case of name collisions. Note that this policy doesn't prevent function name collisions, only libraries.
HashFieldConditionalChange
Bases: Enum
Field conditional change options for HSETEX command.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
39 40 41 42 43 44 45 46 47 48 | |
ONLY_IF_ALL_EXIST = 'FXX'
class-attribute
instance-attribute
Only set fields if all of them already exist. Equivalent to FXX in the Valkey API.
ONLY_IF_NONE_EXIST = 'FNX'
class-attribute
instance-attribute
Only set fields if none of them already exist. Equivalent to FNX in the Valkey API.
InfoSection
Bases: Enum
INFO option: a specific section of information:
When no parameter is provided, the default option is assumed.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
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 | |
SERVER = 'server'
class-attribute
instance-attribute
General information about the server
CLIENTS = 'clients'
class-attribute
instance-attribute
Client connections section
MEMORY = 'memory'
class-attribute
instance-attribute
Memory consumption related information
PERSISTENCE = 'persistence'
class-attribute
instance-attribute
RDB and AOF related information
STATS = 'stats'
class-attribute
instance-attribute
General statistics
REPLICATION = 'replication'
class-attribute
instance-attribute
Master/replica replication information
CPU = 'cpu'
class-attribute
instance-attribute
CPU consumption statistics
COMMAND_STATS = 'commandstats'
class-attribute
instance-attribute
Valkey command statistics
LATENCY_STATS = 'latencystats'
class-attribute
instance-attribute
Valkey command latency percentile distribution statistics
SENTINEL = 'sentinel'
class-attribute
instance-attribute
Valkey Sentinel section (only applicable to Sentinel instances)
CLUSTER = 'cluster'
class-attribute
instance-attribute
Valkey Cluster section
MODULES = 'modules'
class-attribute
instance-attribute
Modules section
KEYSPACE = 'keyspace'
class-attribute
instance-attribute
Database related statistics
ERROR_STATS = 'errorstats'
class-attribute
instance-attribute
Valkey error statistics
ALL = 'all'
class-attribute
instance-attribute
Return all sections (excluding module generated ones)
DEFAULT = 'default'
class-attribute
instance-attribute
Return only the default set of sections
EVERYTHING = 'everything'
class-attribute
instance-attribute
Includes all and modules
OnlyIfEqual
dataclass
Change condition to the SET command,
For additional conditonal options see ConditionalChange
- comparison_value - value to compare to the current value of a key.
If comparison_value is equal to the key, it will overwrite the value of key to the new provided value Equivalent to the IFEQ comparison-value in the Valkey API
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
51 52 53 54 55 56 57 58 59 60 61 62 63 | |
PubSubMsg
dataclass
Describes the incoming pubsub message
Attributes:
| Name | Type | Description |
|---|---|---|
message |
TEncodable
|
Incoming message. |
channel |
TEncodable
|
Name of an channel that triggered the message. |
pattern |
Optional[TEncodable]
|
Pattern that triggered the message. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
UpdateOptions
Bases: Enum
Options for updating elements of a sorted set key.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/core_options.py
199 200 201 202 203 204 205 206 207 208 | |
LESS_THAN = 'LT'
class-attribute
instance-attribute
Only update existing elements if the new score is less than the current score.
GREATER_THAN = 'GT'
class-attribute
instance-attribute
Only update existing elements if the new score is greater than the current score.
AggregationType
Bases: Enum
Enumeration representing aggregation types for ZINTERSTORE and ZUNIONSTORE sorted set commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
SUM = 'SUM'
class-attribute
instance-attribute
Represents aggregation by summing the scores of elements across inputs where they exist.
MIN = 'MIN'
class-attribute
instance-attribute
Represents aggregation by selecting the minimum score of an element across inputs where it exists.
MAX = 'MAX'
class-attribute
instance-attribute
Represents aggregation by selecting the maximum score of an element across inputs where it exists.
GeoSearchByBox
Represents search criteria of searching within a specified rectangular area.
Attributes:
| Name | Type | Description |
|---|---|---|
width |
float
|
Width of the bounding box. |
height |
float
|
Height of the bounding box |
unit |
GeoUnit
|
Unit of the radius. See |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
to_args()
Convert the search criteria to the corresponding part of the command.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: List representation of the search criteria. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
252 253 254 255 256 257 258 259 | |
GeoSearchByRadius
Represents search criteria of searching within a certain radius from a specified point.
Attributes:
| Name | Type | Description |
|---|---|---|
radius |
float
|
Radius of the search area. |
unit |
GeoUnit
|
Unit of the radius. See |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
to_args()
Convert the search criteria to the corresponding part of the command.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: List representation of the search criteria. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
224 225 226 227 228 229 230 231 | |
GeoSearchCount
Represents the count option for limiting the number of results in a GeoSearch.
Attributes:
| Name | Type | Description |
|---|---|---|
count |
int
|
The maximum number of results to return. |
any_option |
bool
|
Whether to allow returning as enough matches are found. This means that the results returned may not be the ones closest to the specified point. Default to False. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
to_args()
Convert the count option to the corresponding part of the command.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: List representation of the count option. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
279 280 281 282 283 284 285 286 287 288 | |
GeospatialData
Represents a geographic position defined by longitude and latitude.
The exact limits, as specified by EPSG:900913 / EPSG:3785 / OSGEO:41001 are the following:
- Valid longitudes are from -180 to 180 degrees.
- Valid latitudes are from -85.05112878 to 85.05112878 degrees.
Attributes:
| Name | Type | Description |
|---|---|---|
longitude |
float
|
The longitude coordinate. |
latitude |
float
|
The latitude coordinate. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
GeoUnit
Bases: Enum
Enumeration representing distance units options for the GEODIST command.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
METERS = 'm'
class-attribute
instance-attribute
Represents distance in meters.
KILOMETERS = 'km'
class-attribute
instance-attribute
Represents distance in kilometers.
MILES = 'mi'
class-attribute
instance-attribute
Represents distance in miles.
FEET = 'ft'
class-attribute
instance-attribute
Represents distance in feet.
InfBound
Bases: Enum
Enumeration representing numeric and lexicographic positive and negative infinity bounds for sorted set.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
POS_INF = {'score_arg': '+inf', 'lex_arg': '+'}
class-attribute
instance-attribute
Positive infinity bound for sorted set.
score_arg: represents numeric positive infinity (+inf).
lex_arg: represents lexicographic positive infinity (+).
NEG_INF = {'score_arg': '-inf', 'lex_arg': '-'}
class-attribute
instance-attribute
Negative infinity bound for sorted set.
score_arg: represents numeric negative infinity (-inf).
lex_arg: represents lexicographic negative infinity (-).
LexBoundary
Represents a specific lexicographic boundary in a sorted set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The lex value. |
required |
is_inclusive
|
bool
|
Whether the score value is inclusive. Defaults to True. |
True
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
84 85 86 87 88 89 90 91 92 93 94 95 | |
RangeByIndex
Represents a range by index (rank) in a sorted set.
The start and end arguments represent zero-based indexes.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
int
|
The start index of the range. |
end |
int
|
The end index of the range. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
RangeByLex
Represents a range by lexicographical order in a sorted set.
The start and end arguments represent lexicographical boundaries.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
Union[InfBound, LexBoundary]
|
The start lexicographic boundary. |
end |
Union[InfBound, LexBoundary]
|
The end lexicographic boundary. |
limit |
Optional[Limit]
|
The limit argument for a range query. Defaults to None. See |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
RangeByScore
Represents a range by score in a sorted set.
The start and end arguments represent score boundaries.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
Union[InfBound, ScoreBoundary]
|
The start score boundary. |
end |
Union[InfBound, ScoreBoundary]
|
The end score boundary. |
limit |
Optional[Limit]
|
The limit argument for a range query. Defaults to None. See |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
ScoreBoundary
Represents a specific numeric score boundary in a sorted set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
The score value. |
required |
is_inclusive
|
bool
|
Whether the score value is inclusive. Defaults to True. |
True
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
70 71 72 73 74 75 76 77 78 79 80 81 | |
ScoreFilter
Bases: Enum
Defines which elements to pop from a sorted set.
ScoreFilter is a mandatory option for ZMPOP and BZMPOP.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/sorted_set.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
MIN = 'MIN'
class-attribute
instance-attribute
Pop elements with the lowest scores.
MAX = 'MAX'
class-attribute
instance-attribute
Pop elements with the highest scores.
ExclusiveIdBound
Bases: StreamRangeBound
Exclusive (open) stream ID boundary used to specify a range of IDs to search. Stream ID bounds can be complete with a timestamp and sequence number separated by a dash ("-"), for example "1526985054069-0". Stream ID bounds can also be incomplete, with just a timestamp.
Since: Valkey version 6.2.0.
Attributes:
| Name | Type | Description |
|---|---|---|
stream_id |
TEncodable
|
The stream ID. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
from_timestamp(timestamp)
staticmethod
Creates an incomplete stream ID boundary without the sequence number for a range search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
int
|
The stream ID timestamp. |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
222 223 224 225 226 227 228 229 230 | |
IdBound
Bases: StreamRangeBound
Inclusive (closed) stream ID boundary used to specify a range of IDs to search. Stream ID bounds can be complete with a timestamp and sequence number separated by a dash ("-"), for example "1526985054069-0". Stream ID bounds can also be incomplete, with just a timestamp.
Attributes:
| Name | Type | Description |
|---|---|---|
stream_id |
str
|
The stream ID. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
from_timestamp(timestamp)
staticmethod
Creates an incomplete stream ID boundary without the sequence number for a range search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
int
|
The stream ID timestamp. |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
188 189 190 191 192 193 194 195 196 | |
MaxId
Bases: StreamRangeBound
Stream ID boundary used to specify the maximum stream entry ID. Can be used in the XRANGE or XREVRANGE commands
to get the last stream ID.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
166 167 168 169 170 171 172 173 174 175 | |
MinId
Bases: StreamRangeBound
Stream ID boundary used to specify the minimum stream entry ID. Can be used in the XRANGE or XREVRANGE commands
to get the first stream ID.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
154 155 156 157 158 159 160 161 162 163 | |
StreamAddOptions
Options for adding entries to a stream.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
Optional[TEncodable]
|
ID for the new entry. If set, the new entry will be added with this ID. If not specified, '*' is used. |
make_stream |
bool
|
If set to False, a new stream won't be created if no stream matches the given key. |
trim |
Optional[StreamTrimOptions]
|
If set, the add operation will also trim the older entries in the stream.
See |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
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 | |
to_args()
Convert options to arguments for the command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[str]: List of arguments for the command. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
StreamClaimOptions
Options for XCLAIM.
Attributes:
| Name | Type | Description |
|---|---|---|
idle |
Optional[int]
|
Set the idle time (last time it was delivered) of the message in milliseconds. If idle
is not specified, an idle of |
idle_unix_time |
Optional[int]
|
This is the same as idle but instead of a relative amount of milliseconds,
it sets the idle time to a specific Unix time (in milliseconds). This is useful in order to rewrite the AOF
file generating |
retry_count |
Optional[int]
|
Set the retry counter to the specified value. This counter is incremented every
time a message is delivered again. Normally |
is_force |
Optional[bool]
|
Creates the pending message entry in the PEL even if certain specified IDs are not already in the PEL assigned to a different client. However, the message must exist in the stream, otherwise the IDs of non-existing messages are ignored. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
to_args()
Converts options for XCLAIM into a List.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[str]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
StreamGroupOptions
Options for creating stream consumer groups. Can be used as an optional argument to XGROUP CREATE.
Attributes:
| Name | Type | Description |
|---|---|---|
make_stream |
bool
|
If set to True and the stream doesn't exist, this creates a new stream with a length of 0. |
entries_read |
(Optional[int]): A value representing the number of stream entries already read by the group. This option can only be specified if you are using Valkey version 7.0.0 or above. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
to_args()
Returns the options as a list of string arguments to be used in the XGROUP CREATE command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[TEncodable]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
StreamPendingOptions
Options for XPENDING that can be used to filter returned items by minimum idle time and consumer name.
Attributes:
| Name | Type | Description |
|---|---|---|
min_idle_time_ms |
Optional[int]
|
Filters pending entries by their minimum idle time in milliseconds. This option can only be specified if you are using Valkey version 6.2.0 or above. |
consumer_name |
Optional[TEncodable]
|
Filters pending entries by consumer name. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
StreamRangeBound
Bases: ABC
Abstract Base Class used in the XPENDING, XRANGE, and XREVRANGE commands to specify the starting and ending
range bound for the stream search by stream entry ID.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
140 141 142 143 144 145 146 147 148 149 150 151 | |
to_arg()
abstractmethod
Returns the stream range bound as a string argument to be used in the XRANGE or XREVRANGE commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
146 147 148 149 150 151 | |
StreamReadGroupOptions
Bases: StreamReadOptions
Options for reading entries from streams using a consumer group. Can be used as an optional argument to
XREADGROUP.
Attributes:
| Name | Type | Description |
|---|---|---|
no_ack |
bool
|
If set, messages are not added to the Pending Entries List (PEL). This is equivalent to
acknowledging the message when it is read. Equivalent to |
block_ms |
Optional[int]
|
If provided, the request will be blocked for the set amount of milliseconds or
until the server has the required number of entries. Equivalent to |
count |
Optional[int]
|
The maximum number of elements requested. Equivalent to |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
to_args()
Returns the options as a list of string arguments to be used in the XREADGROUP command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[TEncodable]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
334 335 336 337 338 339 340 341 342 343 344 345 | |
StreamReadOptions
Options for reading entries from streams. Can be used as an optional argument to XREAD.
Attributes:
| Name | Type | Description |
|---|---|---|
block_ms |
Optional[int]
|
If provided, the request will be blocked for the set amount of milliseconds or
until the server has the required number of entries. Equivalent to |
count |
Optional[int]
|
The maximum number of elements requested. Equivalent to |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
to_args()
Returns the options as a list of string arguments to be used in the XREAD command.
Returns:
| Type | Description |
|---|---|
List[TEncodable]
|
List[TEncodable]: The options as a list of arguments for the |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
StreamTrimOptions
Bases: ABC
Abstract base class for stream trim options.
Attributes:
| Name | Type | Description |
|---|---|---|
exact |
bool
|
If |
threshold |
Union[TEncodable, int]
|
Threshold for trimming. |
method |
str
|
Method for trimming (e.g., MINID, MAXLEN). |
limit |
Optional[int]
|
Max number of entries to be trimmed. Defaults to None.
Note: If |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
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 | |
to_args()
Convert options to arguments for the command.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: List of arguments for the command. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
TrimByMaxLen
Bases: StreamTrimOptions
Stream trim option to trim by maximum length.
Attributes:
| Name | Type | Description |
|---|---|---|
exact |
bool
|
If |
threshold |
int
|
Threshold for trimming by maximum length. |
limit |
Optional[int]
|
Max number of entries to be trimmed. Defaults to None.
Note: If |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
TrimByMinId
Bases: StreamTrimOptions
Stream trim option to trim by minimum ID.
Attributes:
| Name | Type | Description |
|---|---|---|
exact |
bool
|
If |
threshold |
TEncodable
|
Threshold for trimming by minimum ID. |
limit |
Optional[int]
|
Max number of entries to be trimmed. Defaults to None.
Note: If |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/stream.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
AdvancedGlideClientConfiguration
Bases: AdvancedBaseClientConfiguration
Represents the advanced configuration settings for a Standalone Glide client.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 | |
AdvancedGlideClusterClientConfiguration
Bases: AdvancedBaseClientConfiguration
Represents the advanced configuration settings for a Glide Cluster client.
Attributes:
| Name | Type | Description |
|---|---|---|
connection_timeout |
Optional[int]
|
The duration in milliseconds to wait for a TCP/TLS connection to complete. This applies both during initial client creation and any reconnection that may occur during request processing. Note: A high connection timeout may lead to prolonged blocking of the entire command pipeline. If not explicitly set, a default value of 2000 milliseconds will be used. |
tls_config |
Optional[TlsAdvancedConfiguration]
|
The advanced TLS configuration settings. This allows for more granular control of TLS behavior, such as enabling an insecure mode that bypasses certificate validation. |
refresh_topology_from_initial_nodes |
bool
|
Enables refreshing the cluster topology using only the initial nodes. When this option is enabled, all topology updates (both the periodic checks and on-demand refreshes triggered by topology changes) will query only the initial nodes provided when creating the client, rather than using the internal cluster view. |
pubsub_reconciliation_interval |
Optional[int]
|
The interval in milliseconds between PubSub subscription reconciliation attempts. The reconciliation process ensures that the client's desired subscriptions match the actual subscriptions on the server. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | |
BackoffStrategy
Represents the strategy used to determine how and when to reconnect, in case of connection failures. The time between attempts grows exponentially, to the formula rand(0 .. factor * (exponentBase ^ N)), where N is the number of failed attempts, and rand(...) applies a jitter of up to jitter_percent% to introduce randomness and reduce retry storms. Once the maximum value is reached, that will remain the time between retry attempts until a reconnect attempt is successful. The client will attempt to reconnect indefinitely.
Attributes:
| Name | Type | Description |
|---|---|---|
num_of_retries |
int
|
Number of retry attempts that the client should perform when disconnected from the server, where the time between retries increases. Once the retries have reached the maximum value, the time between retries will remain constant until a reconnect attempt is succesful. |
factor |
int
|
The multiplier that will be applied to the waiting time between each retry. This value is specified in milliseconds. |
exponent_base |
int
|
The exponent base configured for the strategy. |
jitter_percent |
Optional[int]
|
The Jitter percent on the calculated duration. If not set, a default value will be used. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
CompressionBackend
Bases: Enum
Represents the compression backend to use for automatic compression.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
84 85 86 87 88 89 90 91 92 93 94 95 96 | |
ZSTD = ProtobufCompressionBackend.ZSTD
class-attribute
instance-attribute
Use zstd compression backend.
LZ4 = ProtobufCompressionBackend.LZ4
class-attribute
instance-attribute
Use lz4 compression backend.
CompressionConfiguration
dataclass
Represents the compression configuration for automatic compression of values.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
Whether compression is enabled. Defaults to False. |
backend |
CompressionBackend
|
The compression backend to use. Defaults to CompressionBackend.ZSTD. |
compression_level |
Optional[int]
|
The compression level to use. If not set, the backend's default level will be used. Valid ranges are backend-specific and validated by the Rust core. ZSTD default is 3 LZ4 default is 0 |
min_compression_size |
int
|
The minimum size in bytes for values to be compressed. Values smaller than this will not be compressed. Defaults to 64 bytes. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
GlideClientConfiguration
Bases: BaseClientConfiguration
Represents the configuration settings for a Standalone Glide client.
Attributes:
| Name | Type | Description |
|---|---|---|
addresses |
List[NodeAddress]
|
DNS Addresses and ports of known nodes in the cluster. Only nodes whose addresses were provided will be used by the client. For example:: |
use_tls |
bool
|
True if communication with the cluster should use Transport Level Security.
Please use |
credentials |
ServerCredentials
|
Credentials for authentication process. If none are set, the client will not authenticate itself with the server. |
read_from |
ReadFrom
|
If not set, |
request_timeout |
Optional[int]
|
The duration in milliseconds that the client should wait for a request to complete. This duration encompasses sending the request, awaiting for a response from the server, and any required reconnection or retries. If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, a default value of 250 milliseconds will be used. |
reconnect_strategy |
Optional[BackoffStrategy]
|
Strategy used to determine how and when to reconnect, in case of connection failures. If not set, a default backoff strategy will be used. |
database_id |
Optional[int]
|
Index of the logical database to connect to. |
client_name |
Optional[str]
|
Client name to be used for the client. Will be used with CLIENT SETNAME command during connection establishment. |
protocol |
ProtocolVersion
|
The version of the RESP protocol to communicate with the server. |
pubsub_subscriptions |
Optional[PubSubSubscriptions]
|
Pubsub subscriptions to be used for the client. Will be applied via SUBSCRIBE/PSUBSCRIBE commands during connection establishment. |
inflight_requests_limit |
Optional[int]
|
The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed). This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog. If not set, a default value will be used. |
client_az |
Optional[str]
|
Availability Zone of the client. If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits. If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes (first replicas then primary) within the specified AZ if they exist. |
advanced_config |
Optional[AdvancedGlideClientConfiguration]
|
Advanced configuration settings for the client,
see |
compression |
Optional[CompressionConfiguration]
|
Configuration for automatic compression of values. When enabled, the client will automatically compress values for set-type commands and decompress values for get-type commands. This can reduce bandwidth usage and storage requirements. If not set, compression is disabled. |
read_only |
bool
|
When True, enables read-only mode for the standalone client. In read-only mode: - The client skips primary node detection (INFO REPLICATION command) - Write commands are blocked and will return an error - All connected nodes are treated as valid read targets - If no ReadFrom strategy is specified, defaults to PreferReplica This is useful for connecting to replica-only deployments or when you want to prevent accidental write operations. Note: read_only mode is not compatible with AZAffinity or AZAffinityReplicasAndPrimary read strategies. Defaults to False. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | |
PubSubChannelModes
Bases: IntEnum
Describes pubsub subsciption modes. See valkey.io for more details
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
883 884 885 886 887 888 889 890 891 892 | |
Exact = 0
class-attribute
instance-attribute
Use exact channel names
Pattern = 1
class-attribute
instance-attribute
Use channel name patterns
PubSubSubscriptions
dataclass
Describes pubsub configuration for standalone mode client.
Attributes:
| Name | Type | Description |
|---|---|---|
channels_and_patterns |
Dict[PubSubChannelModes, Set[str]]
|
Channels and patterns by modes. |
callback |
Optional[Callable[[PubSubMsg, Any], None]]
|
Optional callback to accept the incomming messages. |
context |
Any
|
Arbitrary context to pass to the callback. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | |
GlideClusterClientConfiguration
Bases: BaseClientConfiguration
Represents the configuration settings for a Cluster Glide client.
Attributes:
| Name | Type | Description |
|---|---|---|
addresses |
List[NodeAddress]
|
DNS Addresses and ports of known nodes in the cluster. The list can be partial, as the client will attempt to map out the cluster and find all nodes. For example:: |
use_tls |
bool
|
True if communication with the cluster should use Transport Level Security.
For advanced tls configuration, please use |
credentials |
ServerCredentials
|
Credentials for authentication process. If none are set, the client will not authenticate itself with the server. |
read_from |
ReadFrom
|
If not set, |
request_timeout |
Optional[int]
|
The duration in milliseconds that the client should wait for a request to complete. This duration encompasses sending the request, awaiting for a response from the server, and any required reconnection or retries. If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, a default value of 250 milliseconds will be used. |
reconnect_strategy |
Optional[BackoffStrategy]
|
Strategy used to determine how and when to reconnect, in case of connection failures. If not set, a default backoff strategy will be used. |
database_id |
Optional[int]
|
Index of the logical database to connect to. |
client_name |
Optional[str]
|
Client name to be used for the client. Will be used with CLIENT SETNAME command during connection establishment. |
protocol |
ProtocolVersion
|
The version of the RESP protocol to communicate with the server. |
periodic_checks |
Union[PeriodicChecksStatus, PeriodicChecksManualInterval]
|
Configure the periodic topology checks. These checks evaluate changes in the cluster's topology, triggering a slot refresh when detected. Periodic checks ensure a quick and efficient process by querying a limited number of nodes. Defaults to PeriodicChecksStatus.ENABLED_DEFAULT_CONFIGS. |
pubsub_subscriptions |
Optional[PubSubSubscriptions]
|
Pubsub subscriptions to be used for the client. Will be applied via SUBSCRIBE/PSUBSCRIBE/SSUBSCRIBE commands during connection establishment. |
inflight_requests_limit |
Optional[int]
|
The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed). This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog. If not set, a default value will be used. |
client_az |
Optional[str]
|
Availability Zone of the client. If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits. If ReadFrom strategy is AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes (first replicas then primary) within the specified AZ if they exist. |
advanced_config |
Optional[AdvancedGlideClusterClientConfiguration])
|
Advanced configuration settings for the client,
see |
compression |
Optional[CompressionConfiguration]
|
Configuration for automatic compression of values. When enabled, the client will automatically compress values for set-type commands and decompress values for get-type commands. This can reduce bandwidth usage and storage requirements. If not set, compression is disabled. |
Note
Currently, the reconnection strategy in cluster mode is not configurable, and exponential backoff with fixed values is used.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | |
PubSubChannelModes
Bases: IntEnum
Describes pubsub subsciption modes. See valkey.io for more details
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | |
Exact = 0
class-attribute
instance-attribute
Use exact channel names
Pattern = 1
class-attribute
instance-attribute
Use channel name patterns
Sharded = 2
class-attribute
instance-attribute
Use sharded pubsub. Available since Valkey version 7.0.
PubSubSubscriptions
dataclass
Describes pubsub configuration for cluster mode client.
Attributes:
| Name | Type | Description |
|---|---|---|
channels_and_patterns |
Dict[PubSubChannelModes, Set[str]]
|
Channels and patterns by modes. |
callback |
Optional[Callable[[PubSubMsg, Any], None]]
|
Optional callback to accept the incoming messages. |
context |
Any
|
Arbitrary context to pass to the callback. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | |
IamAuthConfig
Configuration settings for IAM authentication.
Attributes:
| Name | Type | Description |
|---|---|---|
cluster_name |
str
|
The name of the ElastiCache/MemoryDB cluster. |
service |
ServiceType
|
The type of service being used (ElastiCache or MemoryDB). |
region |
str
|
The AWS region where the ElastiCache/MemoryDB cluster is located. |
refresh_interval_seconds |
Optional[int]
|
Optional refresh interval in seconds for renewing IAM authentication tokens. If not provided, the core will use a default value of 300 seconds (5 min). |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
NodeAddress
Represents the address and port of a node in the cluster.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
The server host. Defaults to "localhost". |
port |
int
|
The server port. Defaults to 6379. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
29 30 31 32 33 34 35 36 37 38 39 40 | |
PeriodicChecksManualInterval
Represents a manually configured interval for periodic checks.
Attributes:
| Name | Type | Description |
|---|---|---|
duration_in_sec |
int
|
The duration in seconds for the interval between periodic checks. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
328 329 330 331 332 333 334 335 336 337 | |
PeriodicChecksStatus
Bases: Enum
Represents the cluster's periodic checks status. To configure specific interval, see PeriodicChecksManualInterval.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
ENABLED_DEFAULT_CONFIGS = 0
class-attribute
instance-attribute
Enables the periodic checks with the default configurations.
DISABLED = 1
class-attribute
instance-attribute
Disables the periodic checks.
ProtocolVersion
Bases: Enum
Represents the communication protocol with the server.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
69 70 71 72 73 74 75 76 77 78 79 80 81 | |
RESP2 = SentProtocolVersion.RESP2
class-attribute
instance-attribute
Communicate using RESP2.
RESP3 = SentProtocolVersion.RESP3
class-attribute
instance-attribute
Communicate using RESP3.
ReadFrom
Bases: Enum
Represents the client's read from strategy.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
PRIMARY = ProtobufReadFrom.Primary
class-attribute
instance-attribute
Always get from primary, in order to get the freshest data.
PREFER_REPLICA = ProtobufReadFrom.PreferReplica
class-attribute
instance-attribute
Spread the requests between all replicas in a round robin manner. If no replica is available, route the requests to the primary.
AZ_AFFINITY = ProtobufReadFrom.AZAffinity
class-attribute
instance-attribute
Spread the read requests between replicas in the same client's AZ (Aviliablity zone) in a round robin manner, falling back to other replicas or the primary if needed
AZ_AFFINITY_REPLICAS_AND_PRIMARY = ProtobufReadFrom.AZAffinityReplicasAndPrimary
class-attribute
instance-attribute
Spread the read requests among nodes within the client's Availability Zone (AZ) in a round robin manner, prioritizing local replicas, then the local primary, and falling back to any replica or the primary if needed.
ServerCredentials
Represents the credentials for connecting to a server.
Exactly one of the following authentication modes must be provided
- Password-based authentication: Use password (and optionally username)
- IAM authentication: Use username (required) and iam_config
These modes are mutually exclusive - you cannot use both simultaneously.
Attributes:
| Name | Type | Description |
|---|---|---|
password |
Optional[str]
|
The password that will be used for authenticating connections to the servers. Mutually exclusive with iam_config. Either password or iam_config must be provided. |
username |
Optional[str]
|
The username that will be used for authenticating connections to the servers. If not supplied for password-based authentication, "default" will be used. Required for IAM authentication. |
iam_config |
Optional[IamAuthConfig]
|
IAM authentication configuration. Mutually exclusive with password. Either password or iam_config must be provided. The client will automatically generate and refresh the authentication token based on the provided configuration. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
is_iam_auth()
Returns True if this credential is configured for IAM authentication.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
323 324 325 | |
ServiceType
Bases: Enum
Represents the types of AWS services that can be used for IAM authentication.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
240 241 242 243 244 245 246 247 248 | |
ELASTICACHE = 0
class-attribute
instance-attribute
Amazon ElastiCache service.
MEMORYDB = 1
class-attribute
instance-attribute
Amazon MemoryDB service.
TlsAdvancedConfiguration
Represents advanced TLS configuration settings.
Attributes:
| Name | Type | Description |
|---|---|---|
use_insecure_tls |
Optional[bool]
|
Whether to bypass TLS certificate verification.
|
root_pem_cacerts |
Optional[bytes]
|
Custom root certificate data for TLS connections in PEM format.
Example usage:: |
client_cert_pem |
Optional[bytes]
|
Client certificate data for mutual TLS authentication in PEM format.
Example usage:: |
client_key_pem |
Optional[bytes]
|
Client private key data for mutual TLS authentication in PEM format.
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/config.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
ClosingError
Bases: GlideError
Errors that report that the client has closed and is no longer usable.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
20 21 22 23 24 25 | |
ConfigurationError
Bases: RequestError
Errors that are thrown when a request cannot be completed in current configuration settings.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
61 62 63 64 65 66 | |
ConnectionError
Bases: RequestError
Errors that are thrown when a connection disconnects. These errors can be temporary, as the client will attempt to reconnect.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
52 53 54 55 56 57 58 | |
ExecAbortError
Bases: RequestError
Errors that are thrown when a transaction is aborted.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
44 45 46 47 48 49 | |
GlideError
Bases: Exception
Base class for errors.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
8 9 10 11 12 13 14 15 16 17 | |
LoggerError
Bases: GlideError
Errors that are thrown when the logger has an error initializing.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
69 70 71 72 73 74 | |
RequestError
Bases: GlideError
Errors that were reported during a request.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
28 29 30 31 32 33 | |
TimeoutError
Bases: RequestError
Errors that are thrown when a request times out.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/exceptions.py
36 37 38 39 40 41 | |
OpenTelemetryConfig
Configuration for OpenTelemetry integration.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/opentelemetry.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
OpenTelemetryMetricsConfig
Configuration for exporting OpenTelemetry metrics.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/opentelemetry.py
67 68 69 70 71 72 73 74 | |
OpenTelemetryTracesConfig
Configuration for exporting OpenTelemetry traces.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/opentelemetry.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
AllNodes
Bases: Route
Route request to all nodes.
Warning
Don't use it with write commands, they could be routed to a replica (RO) node and fail.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
38 39 40 41 42 43 44 45 46 | |
AllPrimaries
Bases: Route
Route request to all primary nodes.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
49 50 51 52 53 54 | |
ByAddressRoute
Bases: Route
Routes a request to a node by its address
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
The endpoint of the node. If |
port |
Optional[int]
|
The port to access on the node. If port is not provided, |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
RandomNode
Bases: Route
Route request to a random node.
Warning
Don't use it with write commands, because they could be randomly routed to a replica (RO) node and fail.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
57 58 59 60 61 62 63 64 65 | |
SlotIdRoute
Bases: Route
Routes a request to a node by its slot ID
Attributes:
| Name | Type | Description |
|---|---|---|
slot_type |
SlotType
|
Defines type of the node being addressed. |
slot_id |
int
|
Slot number. There are 16384 slots in a Valkey cluster, and each shard
manages a slot range. Unless the slot is known, it's better to route using
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
SlotKeyRoute
Bases: Route
Routes a request to a node by its slot key
Attributes:
| Name | Type | Description |
|---|---|---|
slot_type |
SlotType
|
Defines type of the node being addressed. |
slot_key |
str
|
The request will be sent to nodes managing this key. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
68 69 70 71 72 73 74 75 76 77 78 79 | |
SlotType
Bases: Enum
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
15 16 17 18 19 20 21 22 23 24 25 26 27 | |
PRIMARY = 1
class-attribute
instance-attribute
Address a primary node.
REPLICA = 2
class-attribute
instance-attribute
Address a replica node.
REPLICA overrides the read_from_replica configuration. If it's used the request
will be routed to a replica, even if the strategy is ALWAYS_FROM_MASTER.