|
11 | 11 | Mapping, |
12 | 12 | NoReturn, |
13 | 13 | Optional, |
| 14 | + Sequence, |
14 | 15 | Union, |
15 | 16 | ) |
16 | 17 |
|
|
25 | 26 | PatternT, |
26 | 27 | ResponseT, |
27 | 28 | ) |
| 29 | +from redis.utils import deprecated_function |
28 | 30 |
|
29 | 31 | from .core import ( |
30 | 32 | ACLCommands, |
@@ -755,6 +757,76 @@ def readwrite(self, target_nodes: Optional["TargetNodesT"] = None) -> ResponseT: |
755 | 757 | self.read_from_replicas = False |
756 | 758 | return self.execute_command("READWRITE", target_nodes=target_nodes) |
757 | 759 |
|
| 760 | + @deprecated_function( |
| 761 | + version="7.2.0", |
| 762 | + reason="Use client-side caching feature instead.", |
| 763 | + ) |
| 764 | + def client_tracking_on( |
| 765 | + self, |
| 766 | + clientid: Optional[int] = None, |
| 767 | + prefix: Sequence[KeyT] = [], |
| 768 | + bcast: bool = False, |
| 769 | + optin: bool = False, |
| 770 | + optout: bool = False, |
| 771 | + noloop: bool = False, |
| 772 | + target_nodes: Optional["TargetNodesT"] = "all", |
| 773 | + ) -> ResponseT: |
| 774 | + """ |
| 775 | + Enables the tracking feature of the Redis server, that is used |
| 776 | + for server assisted client side caching. |
| 777 | +
|
| 778 | + When clientid is provided - in target_nodes only the node that owns the |
| 779 | + connection with this id should be provided. |
| 780 | + When clientid is not provided - target_nodes can be any node. |
| 781 | +
|
| 782 | + For more information see https://redis.io/commands/client-tracking |
| 783 | + """ |
| 784 | + return self.client_tracking( |
| 785 | + True, |
| 786 | + clientid, |
| 787 | + prefix, |
| 788 | + bcast, |
| 789 | + optin, |
| 790 | + optout, |
| 791 | + noloop, |
| 792 | + target_nodes=target_nodes, |
| 793 | + ) |
| 794 | + |
| 795 | + @deprecated_function( |
| 796 | + version="7.2.0", |
| 797 | + reason="Use client-side caching feature instead.", |
| 798 | + ) |
| 799 | + def client_tracking_off( |
| 800 | + self, |
| 801 | + clientid: Optional[int] = None, |
| 802 | + prefix: Sequence[KeyT] = [], |
| 803 | + bcast: bool = False, |
| 804 | + optin: bool = False, |
| 805 | + optout: bool = False, |
| 806 | + noloop: bool = False, |
| 807 | + target_nodes: Optional["TargetNodesT"] = "all", |
| 808 | + ) -> ResponseT: |
| 809 | + """ |
| 810 | + Disables the tracking feature of the Redis server, that is used |
| 811 | + for server assisted client side caching. |
| 812 | +
|
| 813 | + When clientid is provided - in target_nodes only the node that owns the |
| 814 | + connection with this id should be provided. |
| 815 | + When clientid is not provided - target_nodes can be any node. |
| 816 | +
|
| 817 | + For more information see https://redis.io/commands/client-tracking |
| 818 | + """ |
| 819 | + return self.client_tracking( |
| 820 | + False, |
| 821 | + clientid, |
| 822 | + prefix, |
| 823 | + bcast, |
| 824 | + optin, |
| 825 | + optout, |
| 826 | + noloop, |
| 827 | + target_nodes=target_nodes, |
| 828 | + ) |
| 829 | + |
758 | 830 |
|
759 | 831 | class AsyncClusterManagementCommands( |
760 | 832 | ClusterManagementCommands, AsyncManagementCommands |
@@ -782,6 +854,76 @@ async def cluster_delslots(self, *slots: EncodableT) -> List[bool]: |
782 | 854 | ) |
783 | 855 | ) |
784 | 856 |
|
| 857 | + @deprecated_function( |
| 858 | + version="7.2.0", |
| 859 | + reason="Use client-side caching feature instead.", |
| 860 | + ) |
| 861 | + async def client_tracking_on( |
| 862 | + self, |
| 863 | + clientid: Optional[int] = None, |
| 864 | + prefix: Sequence[KeyT] = [], |
| 865 | + bcast: bool = False, |
| 866 | + optin: bool = False, |
| 867 | + optout: bool = False, |
| 868 | + noloop: bool = False, |
| 869 | + target_nodes: Optional["TargetNodesT"] = "all", |
| 870 | + ) -> ResponseT: |
| 871 | + """ |
| 872 | + Enables the tracking feature of the Redis server, that is used |
| 873 | + for server assisted client side caching. |
| 874 | +
|
| 875 | + When clientid is provided - in target_nodes only the node that owns the |
| 876 | + connection with this id should be provided. |
| 877 | + When clientid is not provided - target_nodes can be any node. |
| 878 | +
|
| 879 | + For more information see https://redis.io/commands/client-tracking |
| 880 | + """ |
| 881 | + return await self.client_tracking( |
| 882 | + True, |
| 883 | + clientid, |
| 884 | + prefix, |
| 885 | + bcast, |
| 886 | + optin, |
| 887 | + optout, |
| 888 | + noloop, |
| 889 | + target_nodes=target_nodes, |
| 890 | + ) |
| 891 | + |
| 892 | + @deprecated_function( |
| 893 | + version="7.2.0", |
| 894 | + reason="Use client-side caching feature instead.", |
| 895 | + ) |
| 896 | + async def client_tracking_off( |
| 897 | + self, |
| 898 | + clientid: Optional[int] = None, |
| 899 | + prefix: Sequence[KeyT] = [], |
| 900 | + bcast: bool = False, |
| 901 | + optin: bool = False, |
| 902 | + optout: bool = False, |
| 903 | + noloop: bool = False, |
| 904 | + target_nodes: Optional["TargetNodesT"] = "all", |
| 905 | + ) -> ResponseT: |
| 906 | + """ |
| 907 | + Disables the tracking feature of the Redis server, that is used |
| 908 | + for server assisted client side caching. |
| 909 | +
|
| 910 | + When clientid is provided - in target_nodes only the node that owns the |
| 911 | + connection with this id should be provided. |
| 912 | + When clientid is not provided - target_nodes can be any node. |
| 913 | +
|
| 914 | + For more information see https://redis.io/commands/client-tracking |
| 915 | + """ |
| 916 | + return await self.client_tracking( |
| 917 | + False, |
| 918 | + clientid, |
| 919 | + prefix, |
| 920 | + bcast, |
| 921 | + optin, |
| 922 | + optout, |
| 923 | + noloop, |
| 924 | + target_nodes=target_nodes, |
| 925 | + ) |
| 926 | + |
785 | 927 |
|
786 | 928 | class ClusterDataAccessCommands(DataAccessCommands): |
787 | 929 | """ |
|
0 commit comments