API refactor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-07 16:25:52 +09:00
parent 76d0d86211
commit 91c7e04474
1171 changed files with 81940 additions and 44117 deletions

View File

@@ -7,13 +7,13 @@ from typing import (
Iterable,
Iterator,
List,
Literal,
Mapping,
NoReturn,
Optional,
Union,
)
from redis.compat import Literal
from redis.crc import key_slot
from redis.exceptions import RedisClusterException, RedisError
from redis.typing import (
@@ -23,6 +23,7 @@ from redis.typing import (
KeysT,
KeyT,
PatternT,
ResponseT,
)
from .core import (
@@ -30,21 +31,18 @@ from .core import (
AsyncACLCommands,
AsyncDataAccessCommands,
AsyncFunctionCommands,
AsyncGearsCommands,
AsyncManagementCommands,
AsyncModuleCommands,
AsyncScriptCommands,
DataAccessCommands,
FunctionCommands,
GearsCommands,
ManagementCommands,
ModuleCommands,
PubSubCommands,
ResponseT,
ScriptCommands,
)
from .helpers import list_or_args
from .redismodules import RedisModuleCommands
from .redismodules import AsyncRedisModuleCommands, RedisModuleCommands
if TYPE_CHECKING:
from redis.asyncio.cluster import TargetNodesT
@@ -225,7 +223,7 @@ class ClusterMultiKeyCommands(ClusterCommandsProtocol):
The keys are first split up into slots
and then an DEL command is sent for every slot
Non-existant keys are ignored.
Non-existent keys are ignored.
Returns the number of keys that were deleted.
For more information see https://redis.io/commands/del
@@ -240,7 +238,7 @@ class ClusterMultiKeyCommands(ClusterCommandsProtocol):
The keys are first split up into slots
and then an TOUCH command is sent for every slot
Non-existant keys are ignored.
Non-existent keys are ignored.
Returns the number of keys that were touched.
For more information see https://redis.io/commands/touch
@@ -254,7 +252,7 @@ class ClusterMultiKeyCommands(ClusterCommandsProtocol):
The keys are first split up into slots
and then an TOUCH command is sent for every slot
Non-existant keys are ignored.
Non-existent keys are ignored.
Returns the number of keys that were unlinked.
For more information see https://redis.io/commands/unlink
@@ -595,7 +593,7 @@ class ClusterManagementCommands(ManagementCommands):
"CLUSTER SETSLOT", slot_id, state, node_id, target_nodes=target_node
)
elif state.upper() == "STABLE":
raise RedisError('For "stable" state please use ' "cluster_setslot_stable")
raise RedisError('For "stable" state please use cluster_setslot_stable')
else:
raise RedisError(f"Invalid slot state: {state}")
@@ -693,12 +691,6 @@ class ClusterManagementCommands(ManagementCommands):
self.read_from_replicas = False
return self.execute_command("READWRITE", target_nodes=target_nodes)
def gears_refresh_cluster(self, **kwargs) -> ResponseT:
"""
On an OSS cluster, before executing any gears function, you must call this command. # noqa
"""
return self.execute_command("REDISGEARS_2.REFRESHCLUSTER", **kwargs)
class AsyncClusterManagementCommands(
ClusterManagementCommands, AsyncManagementCommands
@@ -874,7 +866,6 @@ class RedisClusterCommands(
ClusterDataAccessCommands,
ScriptCommands,
FunctionCommands,
GearsCommands,
ModuleCommands,
RedisModuleCommands,
):
@@ -905,8 +896,8 @@ class AsyncRedisClusterCommands(
AsyncClusterDataAccessCommands,
AsyncScriptCommands,
AsyncFunctionCommands,
AsyncGearsCommands,
AsyncModuleCommands,
AsyncRedisModuleCommands,
):
"""
A class for all Redis Cluster commands