Base Transaction
Home / python / base_transaction
glide.async_commands.transaction.BaseTransaction
Base class encompassing shared commands for both standalone and cluster mode implementations in transaction.
Command Response
The response for each command depends on the executed command. Specific response types are documented alongside each method.
Example
transaction = BaseTransaction() transaction.set("key", "value").get("key") await client.exec(transaction) [OK , "value"]
Source code in glide/async_commands/transaction.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 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 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 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 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 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 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 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 999 1000 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 1043 1044 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 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 |
|
append(key, value)
Appends a value to a key.
If key
does not exist it is created and set as an empty string, so APPEND
will be similar to
SET in this special case.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to which the value will be appended. |
required |
value
|
TEncodable
|
The value to append. |
required |
Commands response
int: The length of the string after appending the value.
Source code in glide/async_commands/transaction.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
bitcount(key, options=None)
Counts the number of set bits (population counting) in a string stored at key
. The options
argument can
optionally be provided to count the number of bits in a specific string interval.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key for the string to count the set bits of. |
required |
options
|
Optional[OffsetOptions]
|
The offset options. |
None
|
Command response
int: If options
is provided, returns the number of set bits in the string interval specified by options
.
If options
is not provided, returns the number of set bits in the string stored at key
.
Otherwise, if key
is missing, returns 0
as it is treated as an empty string.
Source code in glide/async_commands/transaction.py
4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 |
|
bitfield(key, subcommands)
Reads or modifies the array of bits representing the string that is held at key
based on the specified
subcommands
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the string. |
required |
subcommands
|
List[BitFieldSubCommands]
|
The subcommands to be performed on the binary value of the string
at
|
required |
Command response
List[Optional[int]]: An array of results from the executed subcommands:
- `BitFieldGet` returns the value in `BitOffset` or `BitOffsetMultiplier`.
- `BitFieldSet` returns the old value in `BitOffset` or `BitOffsetMultiplier`.
- `BitFieldIncrBy` returns the new value in `BitOffset` or `BitOffsetMultiplier`.
- `BitFieldOverflow` determines the behavior of the "SET" and "INCRBY" subcommands when an overflow or
underflow occurs. "OVERFLOW" does not return a value and does not contribute a value to the list
response.
Source code in glide/async_commands/transaction.py
4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 |
|
bitfield_read_only(key, subcommands)
Reads the array of bits representing the string that is held at key
based on the specified subcommands
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the string. |
required |
subcommands
|
List[BitFieldGet]
|
The "GET" subcommands to be performed. |
required |
Command response
List[int]: An array of results from the "GET" subcommands.
Since: Valkey version 6.0.0.
Source code in glide/async_commands/transaction.py
4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 |
|
bitop(operation, destination, keys)
Perform a bitwise operation between multiple keys (containing string values) and store the result in the
destination
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
BitwiseOperation
|
The bitwise operation to perform. |
required |
destination
|
TEncodable
|
The key that will store the resulting string. |
required |
keys
|
List[TEncodable]
|
The list of keys to perform the bitwise operation on. |
required |
Command response
int: The size of the string stored in destination
.
Source code in glide/async_commands/transaction.py
4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 |
|
bitpos(key, bit, options=None)
Returns the position of the first bit matching the given bit
value. The optional starting offset
start
is a zero-based index, with 0
being the first byte of the list, 1
being the next byte and so on.
The offset can also be a negative number indicating an offset starting at the end of the list, with -1
being
the last byte of the list, -2
being the penultimate, and so on.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the string. |
required |
bit
|
int
|
The bit value to match. Must be |
required |
options
|
Optional[OffsetOptions]
|
The offset options. |
None
|
Command response
int: The position of the first occurrence of bit
in the binary value of the string held at key
.
If start
was provided, the search begins at the offset indicated by start
.
Source code in glide/async_commands/transaction.py
4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 |
|
blmove(source, destination, where_from, where_to, timeout)
Blocks the connection until it pops atomically and removes the left/right-most element to the
list stored at source
depending on where_from
, and pushes the element at the first/last element
of the list stored at destination
depending on where_to
.
blmove
is the blocking variant of lmove
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
TEncodable
|
The key to the source list. |
required |
destination
|
TEncodable
|
The key to the destination list. |
required |
where_from
|
ListDirection
|
The direction to remove the element from
( |
required |
where_to
|
ListDirection
|
The direction to add the element to
( |
required |
timeout
|
float
|
The number of seconds to wait for a blocking operation to complete.
A value of |
required |
Command response
Optional[bytes]: The popped element.
None
if source
does not exist or if the operation timed-out.
Since: Valkey version 6.2.0.
Source code in glide/async_commands/transaction.py
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 |
|
blmpop(keys, direction, timeout, count=None)
Blocks the connection until it pops one or more elements from the first non-empty list from the provided keys
.
BLMPOP
is the blocking variant of LMPOP
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
An array of keys of lists. |
required |
direction
|
ListDirection
|
The direction based on which elements are popped from
( |
required |
timeout
|
float
|
The number of seconds to wait for a blocking operation to complete.
A value of |
required |
count
|
Optional[int]
|
The maximum number of popped elements. If not provided, defaults to popping a single element. |
None
|
Command response
Optional[Mapping[bytes, List[bytes]]]: A map of key
name mapped to an array of popped elements.
None if no elements could be popped and the timeout expired.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
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 |
|
blpop(keys, timeout)
Pops an element from the head of the first list that is non-empty, with the given keys being checked in the order that they are given. Blocks the connection when there are no elements to pop from any of the given lists.
See valkey.io for details.
Note
BLPOP is a client blocking command, see blocking commands for more details and best practices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the lists to pop from. |
required |
timeout
|
float
|
The number of seconds to wait for a blocking operation to complete. A value of 0 will block indefinitely. |
required |
Command response
Optional[List[bytes]]: A two-element list containing the key from which the element was popped and the value of the
popped element, formatted as [key, value]
.
If no element could be popped and the timeout
expired, returns None.
Source code in glide/async_commands/transaction.py
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 |
|
brpop(keys, timeout)
Pops an element from the tail of the first list that is non-empty, with the given keys being checked in the order that they are given. Blocks the connection when there are no elements to pop from any of the given lists.
See valkey.io for details.
Note
BRPOP is a client blocking command, see blocking commands for more details and best practices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the lists to pop from. |
required |
timeout
|
float
|
The number of seconds to wait for a blocking operation to complete. A value of 0 will block indefinitely. |
required |
Command response
Optional[List[bytes]]: A two-element list containing the key from which the element was popped and the value of the
popped element, formatted as [key, value]
.
If no element could be popped and the timeout
expired, returns None.
Source code in glide/async_commands/transaction.py
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 |
|
bzmpop(keys, modifier, timeout, count=None)
Pops a member-score pair from the first non-empty sorted set, with the given keys being checked in the order that they are given. Blocks the connection when there are no members to pop from any of the given sorted sets.
The optional count
argument can be used to specify the number of elements to pop, and is set to 1 by default.
The number of popped elements is the minimum from the sorted set's cardinality and count
.
BZMPOP
is the blocking variant of ZMPOP
.
See valkey.io for more details.
Note
BZMPOP
is a client blocking command, see
blocking commands
for more details and best practices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
modifier
|
ScoreFilter
|
The element pop criteria - either ScoreFilter.MIN or ScoreFilter.MAX to pop members with the lowest/highest scores accordingly. |
required |
timeout
|
float
|
The number of seconds to wait for a blocking operation to complete. A value of 0 will block indefinitely. |
required |
count
|
Optional[int]
|
The number of elements to pop. |
None
|
Command response
Optional[List[Union[bytes, Mapping[bytes, float]]]]: A two-element list containing the key name of the set from which elements were popped, and a member-score mapping.
If no members could be popped and the timeout expired, returns None.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 |
|
bzpopmax(keys, timeout)
Pops the member with the highest score from the first non-empty sorted set, with the given keys being checked in the order that they are given. Blocks the connection when there are no members to remove from any of the given sorted sets.
BZPOPMAX
is the blocking variant of ZPOPMAX
.
Note
BZPOPMAX
is a client blocking command, see
blocking commands
for more details and best practices.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
timeout
|
float
|
The number of seconds to wait for a blocking operation to complete. A value of 0 will block indefinitely. |
required |
Command response
Optional[List[Union[bytes, float]]]: An array containing the key where the member was popped out, the member itself, and the member score.
If no member could be popped and the timeout
expired, returns None.
Source code in glide/async_commands/transaction.py
3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 |
|
bzpopmin(keys, timeout)
Pops the member with the lowest score from the first non-empty sorted set, with the given keys being checked in the order that they are given. Blocks the connection when there are no members to remove from any of the given sorted sets.
BZPOPMIN
is the blocking variant of ZPOPMIN
.
Note
BZPOPMIN
is a client blocking command, see
blocking commands
for more details and best practices.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
timeout
|
float
|
The number of seconds to wait for a blocking operation to complete. A value of 0 will block indefinitely. |
required |
Command response
Optional[List[Union[bytes, float]]]: An array containing the key where the member was popped out, the member itself, and the member score.
If no member could be popped and the timeout
expired, returns None.
Source code in glide/async_commands/transaction.py
3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 |
|
client_getname()
Get the name of the connection on which the transaction is being executed.
See valkey.io for more details.
Command response
Optional[bytes]: Returns the name of the client connection as a bytes string if a name is set,
Returns None
if no name is assigned.
Source code in glide/async_commands/transaction.py
752 753 754 755 756 757 758 759 760 761 762 763 |
|
client_id()
Returns the current connection id.
See valkey.io for more information.
Command response
int: the id of the client.
Source code in glide/async_commands/transaction.py
473 474 475 476 477 478 479 480 481 482 |
|
config_get(parameters)
Get the values of configuration parameters. Starting from server version 7, command supports multiple parameters.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameters
|
List[TEncodable]
|
A list of configuration parameter names to retrieve values for. |
required |
Command response
Dict[bytes, bytes]: A dictionary of values corresponding to the configuration parameters.
Source code in glide/async_commands/transaction.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
config_resetstat()
Resets the statistics reported by the server using the INFO and LATENCY HISTOGRAM commands.
See valkey.io for details.
Command response
OK: a simple OK response.
Source code in glide/async_commands/transaction.py
378 379 380 381 382 383 384 385 386 387 |
|
config_rewrite()
Rewrite the configuration file with the current configuration.
See valkey.io for details.
Command response
OK: OK is returned when the configuration was rewritten properly.
Otherwise, the transaction fails with an error.
Source code in glide/async_commands/transaction.py
460 461 462 463 464 465 466 467 468 469 470 471 |
|
config_set(parameters_map)
Set configuration parameters to the specified values. Starting from server version 7, command supports multiple parameters.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameters_map
|
Mapping[TEncodable, TEncodable]
|
A map consisting of configuration |
required |
Command response
OK: Returns OK if all configurations have been successfully set.
Otherwise, the transaction fails with an error.
Source code in glide/async_commands/transaction.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
|
custom_command(command_args)
Executes a single command, without checking inputs.
See the Valkey GLIDE Wiki custom command for details on the restrictions and limitations of the custom command API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command_args
|
List[TEncodable]
|
List of command arguments. Every part of the command, including the command name and subcommands, should be added as a separate value in args. |
required |
Command response
TResult: The returning value depends on the executed command.
Example
Append a command to list of all pub/sub clients:
transaction.customCommand(["CLIENT", "LIST","TYPE", "PUBSUB"])
Source code in glide/async_commands/transaction.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 |
|
dbsize()
Returns the number of keys in the currently selected database.
See valkey.io for more details.
Commands response
int: The number of keys in the database.
Source code in glide/async_commands/transaction.py
4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 |
|
decr(key)
Decrements the number stored at key
by one. If the key does not exist, it is set to 0 before performing the
operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to decrement its value. |
required |
Command response
int: the value of key
after the decrement.
Source code in glide/async_commands/transaction.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
|
decrby(key, amount)
Decrements the number stored at key
by amount
. If the key does not exist, it is set to 0 before performing
the operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to decrement its value. |
required |
amount
|
int)
|
The amount to decrement. |
required |
Command response
int: The value of key
after the decrement.
Source code in glide/async_commands/transaction.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
|
delete(keys)
Delete one or more keys from the database. A key is ignored if it does not exist.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
A list of keys to be deleted from the database. |
required |
Command response
int: The number of keys that were deleted.
Source code in glide/async_commands/transaction.py
325 326 327 328 329 330 331 332 333 334 335 336 337 |
|
dump(key)
Serialize the value stored at key
in a Valkey-specific format and return it to the user.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The |
required |
Command response
Optional[bytes]: The serialized value of the data stored at key
.
If key
does not exist, None
will be returned.
Source code in glide/async_commands/transaction.py
2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 |
|
echo(message)
Echoes the provided message
back.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
TEncodable
|
The message to be echoed back. |
required |
Commands response
bytes: The provided message
.
Source code in glide/async_commands/transaction.py
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
|
exists(keys)
Returns the number of keys in keys
that exist in the database.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The list of keys to check. |
required |
Commands response
int: The number of keys that exist. If the same existing key is mentioned in keys
multiple times,
it will be counted multiple times.
Source code in glide/async_commands/transaction.py
1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 |
|
expire(key, seconds, option=None)
Sets a timeout on key
in seconds. After the timeout has expired, the key will automatically be deleted.
If key
already has an existing expire set, the time to live is updated to the new value.
If seconds
is a non-positive number, the key will be deleted rather than expired.
The timeout will only be cleared by commands that delete or overwrite the contents of key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to set a timeout on. |
required |
seconds
|
int
|
The timeout in seconds. |
required |
option
|
Optional[ExpireOptions]
|
The expire option. |
None
|
Commands response
bool: True
if the timeout was set.
False
if the timeout was not set (e.g., the key doesn't exist or the
operation is skipped due to the provided arguments).
Source code in glide/async_commands/transaction.py
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 |
|
expireat(key, unix_seconds, option=None)
Sets a timeout on key
using an absolute Unix timestamp (seconds since January 1, 1970) instead of specifying the
number of seconds.
A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be
deleted.
If key
already has an existing expire set, the time to live is updated to the new value.
The timeout will only be cleared by commands that delete or overwrite the contents of key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to set a timeout on. |
required |
unix_seconds
|
int
|
The timeout in an absolute Unix timestamp. |
required |
option
|
Optional[ExpireOptions]
|
The expire option. |
None
|
Commands response
bool: True
if the timeout was set.
False
if the timeout was not set (e.g., the key doesn't exist or the operation
is skipped due to the provided arguments).
Source code in glide/async_commands/transaction.py
1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 |
|
expiretime(key)
Returns the absolute Unix timestamp (since January 1, 1970) at which
the given key
will expire, in seconds.
To get the expiration with millisecond precision, use pexpiretime
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The |
required |
Commands response
int: The expiration Unix timestamp in seconds.
-2 if key
does not exist.
-1 if key
exists but has no associated expire.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 |
|
fcall(function, keys=None, arguments=None)
Invokes a previously loaded function.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function
|
TEncodable
|
The function name. |
required |
keys
|
Optional[List[TEncodable]]
|
A list of keys accessed by the function. To ensure the correct
execution of functions, both in standalone and clustered deployments, all names of keys
that a function accesses must be explicitly provided as |
None
|
arguments
|
Optional[List[TEncodable]]
|
A list of |
None
|
Command Response
TResult: The invoked function's return value.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 |
|
fcall_ro(function, keys=None, arguments=None)
Invokes a previously loaded read-only function.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function
|
TEncodable
|
The function name. |
required |
keys
|
List[TEncodable]
|
An |
None
|
arguments
|
List[TEncodable]
|
An |
None
|
Command Response
TResult: The return value depends on the function that was executed.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 |
|
flushall(flush_mode=None)
Deletes all the keys of all the existing databases. This command never fails.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flush_mode
|
Optional[FlushMode]
|
The flushing mode, could be either |
None
|
Command Response
TOK: OK.
Source code in glide/async_commands/transaction.py
4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 |
|
flushdb(flush_mode=None)
Deletes all the keys of the currently selected database. This command never fails.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flush_mode
|
Optional[FlushMode]
|
The flushing mode, could be either |
None
|
Command Response
TOK: OK.
Source code in glide/async_commands/transaction.py
4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 |
|
function_delete(library_name)
Deletes a library and all its functions.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
library_name
|
TEncodable
|
The library name to delete |
required |
Commands response
TOK: A simple OK
.
Since: Valkey 7.0.0.
Source code in glide/async_commands/transaction.py
2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 |
|
function_dump()
Returns the serialized payload of all loaded libraries.
See valkey.io for more details.
Command response
bytes: The serialized payload of all loaded libraries.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 |
|
function_flush(mode=None)
Deletes all function libraries.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
Optional[FlushMode]
|
The flushing mode, could be either |
None
|
Commands response
TOK: A simple OK
.
Since: Valkey 7.0.0.
Source code in glide/async_commands/transaction.py
2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 |
|
function_list(library_name_pattern=None, with_code=False)
Returns information about the functions and libraries.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
library_name_pattern
|
Optional[TEncodable]
|
A wildcard pattern for matching library names. |
None
|
with_code
|
bool
|
Specifies whether to request the library code from the server or not. |
False
|
Commands response
TFunctionListResponse: Info about all or selected libraries and their functions.
Since: Valkey 7.0.0.
Source code in glide/async_commands/transaction.py
2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 |
|
function_load(library_code, replace=False)
Loads a library to Valkey.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
library_code
|
TEncodable
|
The source code that implements the library. |
required |
replace
|
bool
|
Whether the given library should overwrite a library with the same name if it already exists. |
False
|
Commands response
bytes: The library name that was loaded.
Since: Valkey 7.0.0.
Source code in glide/async_commands/transaction.py
2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 |
|
function_restore(payload, policy=None)
Restores libraries from the serialized payload returned by the function_dump
command.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
payload
|
TEncodable
|
The serialized data from the |
required |
policy
|
Optional[FunctionRestorePolicy]
|
A policy for handling existing libraries. |
None
|
Command response
TOK: A simple "OK" response.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 |
|
function_stats()
Returns information about the function that's currently running and information about the available execution engines.
See valkey.io for more details
Command Response
TFunctionStatsSingleNodeResponse: A Mapping
with two keys:
- `running_script` with information about the running script.
- `engines` with information about available engines and their stats.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 |
|
geoadd(key, members_geospatialdata, existing_options=None, changed=False)
Adds geospatial members with their positions to the specified sorted set stored at key
.
If a member is already a part of the sorted set, its position is updated.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
members_geospatialdata
|
Mapping[TEncodable, GeospatialData]
|
A mapping of member names to their
corresponding positions. See |
required |
existing_options
|
Optional[ConditionalChange]
|
Options for handling existing members.
|
None
|
changed
|
bool
|
Modify the return value to return the number of changed elements, instead of the number of new elements added. |
False
|
Commands response
int: The number of elements added to the sorted set.
If changed
is set, returns the number of elements updated in the sorted set.
Source code in glide/async_commands/transaction.py
2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 |
|
geodist(key, member1, member2, unit=None)
Returns the distance between two members in the geospatial index stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
member1
|
TEncodable
|
The name of the first member. |
required |
member2
|
TEncodable
|
The name of the second member. |
required |
unit
|
Optional[GeoUnit]
|
The unit of distance measurement. See |
None
|
Commands response
Optional[float]: The distance between member1
and member2
.
If one or both members do not exist, or if the key does not exist, returns None.
Source code in glide/async_commands/transaction.py
3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 |
|
geohash(key, members)
Returns the GeoHash bytes strings representing the positions of all the specified members in the sorted set stored at
key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
members
|
List[TEncodable]
|
The list of members whose GeoHash bytes strings are to be retrieved. |
required |
Commands response
List[Optional[bytes]]: A list of GeoHash bytes strings representing the positions of the specified members
stored at key
.
If a member does not exist in the sorted set, a None value is returned for that member.
Source code in glide/async_commands/transaction.py
3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 |
|
geopos(key, members)
Returns the positions (longitude and latitude) of all the given members of a geospatial index in the sorted set stored
at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
members
|
List[TEncodable]
|
The members for which to get the positions. |
required |
Commands response
List[Optional[List[float]]]: A list of positions (longitude and latitude) corresponding to the given members.
If a member does not exist, its position will be None.
Source code in glide/async_commands/transaction.py
3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 |
|
geosearch(key, search_from, search_by, order_by=None, count=None, with_coord=False, with_dist=False, with_hash=False)
Searches for members in a sorted set stored at key
representing geospatial data within a circular or
rectangular area.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set representing geospatial data. |
required |
search_from
|
Union[TEncodable, GeospatialData]
|
The location to search from. Can be specified either as a member
from the sorted set or as a geospatial data (see |
required |
search_by
|
Union[GeoSearchByRadius, GeoSearchByBox]
|
The search criteria.
For circular area search, see |
required |
order_by
|
Optional[OrderBy]
|
Specifies the order in which the results should be returned.
If not specified, the results would be unsorted. |
None
|
count
|
Optional[GeoSearchCount]
|
Specifies the maximum number of results to return. See |
None
|
with_coord
|
bool
|
Whether to include coordinates of the returned items. Defaults to False. |
False
|
with_dist
|
bool
|
Whether to include distance from the center in the returned items.
The distance is returned in the same unit as specified for the |
False
|
with_hash
|
bool
|
Whether to include geohash of the returned items. Defaults to False. |
False
|
Command Response
List[Union[bytes, List[Union[bytes, float, int, List[float]]]]]: By default, returns a list of members (locations) names.
If any of with_coord
, with_dist
or with_hash
are True, returns an array of arrays, where each sub array
represents a single item in the following order:
- (bytes): The member (location) name.
- (float): The distance from the center as a floating point number, in the same unit specified in the radius,
if `with_dist` is set to True.
- (int): The Geohash integer, if `with_hash` is set to True.
- List[float]: The coordinates as a two item [longitude,latitude] array, if `with_coord` is set to True.
Since: Valkey version 6.2.0.
Source code in glide/async_commands/transaction.py
3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 |
|
geosearchstore(destination, source, search_from, search_by, count=None, store_dist=False)
Searches for members in a sorted set stored at key
representing geospatial data within a circular or rectangular
area and stores the result in destination
.
If destination
already exists, it is overwritten. Otherwise, a new sorted set will be created.
To get the result directly, see geosearch
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key to store the search results. |
required |
source
|
TEncodable
|
The key of the sorted set representing geospatial data to search from. |
required |
search_from
|
Union[TEncodable, GeospatialData]
|
The location to search from. Can be specified either as a member
from the sorted set or as a geospatial data (see |
required |
search_by
|
Union[GeoSearchByRadius, GeoSearchByBox]
|
The search criteria.
For circular area search, see |
required |
count
|
Optional[GeoSearchCount]
|
Specifies the maximum number of results to store. See |
None
|
store_dist
|
bool
|
Determines what is stored as the sorted set score. Defaults to False.
|
False
|
Commands response
int: The number of elements in the resulting sorted set stored at destination
.
Since: Valkey version 6.2.0.
Source code in glide/async_commands/transaction.py
3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 |
|
get(key)
Get the value associated with the given key, or null if no such value exists.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to retrieve from the database. |
required |
Command response
Optional[bytes]: If the key exists, returns the value of the key as a bytes string.
Otherwise, return None.
Source code in glide/async_commands/transaction.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
getbit(key, offset)
Returns the bit value at offset
in the string value stored at key
.
offset
should be greater than or equal to zero.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the string. |
required |
offset
|
int
|
The index of the bit to return. |
required |
Command response
int: The bit at the given offset
of the string.
Returns 0
if the key is empty or if the offset
exceeds the length of the string.
Source code in glide/async_commands/transaction.py
4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 |
|
getdel(key)
Gets a value associated with the given string key
and deletes the key.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The |
required |
Command response
Optional[bytes]: If key
exists, returns the value
of key
.
Otherwise, returns None
.
Source code in glide/async_commands/transaction.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
getex(key, expiry=None)
Get the value of key
and optionally set its expiration. GETEX is similar to GET.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to get. |
required |
expiry
|
Optional[ExpirySet]
|
set expiriation to the given key.
Equivalent to [ |
None
|
Command Response
Optional[bytes]: If key
exists, return the value stored at key
If 'key` does not exist, return 'None'
Since: Valkey version 6.2.0.
Source code in glide/async_commands/transaction.py
4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 |
|
getrange(key, start, end)
Returns the substring of the string value stored at key
, determined by the offsets start
and end
(both are inclusive).
Negative offsets can be used in order to provide an offset starting from the end of the string.
So -1
means the last character, -2
the penultimate and so forth.
If key
does not exist, an empty string is returned. If start
or end
are out of range, returns the substring within the valid range of the string.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the string. |
required |
start
|
int
|
The starting offset. |
required |
end
|
int
|
The ending offset. |
required |
Commands response
bytes: A substring extracted from the value stored at key
.
Source code in glide/async_commands/transaction.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
hdel(key, fields)
Remove specified fields from the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
fields
|
List[TEncodable]
|
The list of fields to remove from the hash stored at |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
TTransaction
|
The number of fields that were removed from the hash, excluding specified but non-existing fields. |
TTransaction
|
If |
Source code in glide/async_commands/transaction.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
|
hexists(key, field)
Check if a field exists in the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
field
|
TEncodable
|
The field to check in the hash stored at |
required |
Command response
bool: Returns True
if the hash contains the specified field. If the hash does not contain the field,
Returns False
if the key does not exist.
Source code in glide/async_commands/transaction.py
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
|
hget(key, field)
Retrieves the value associated with field
in the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
field
|
TEncodable
|
The field whose value should be retrieved. |
required |
Command response
Optional[bytes]: The value associated field
in the hash.
Returns None if field
is not presented in the hash or key
does not exist.
Source code in glide/async_commands/transaction.py
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
|
hgetall(key)
Returns all fields and values of the hash stored at key
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
Command response
Dict[bytes, bytes]: A dictionary of fields and their values stored in the hash. Every field name in the list is followed by its value.
If key
does not exist, it returns an empty dictionary.
Source code in glide/async_commands/transaction.py
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 |
|
hincrby(key, field, amount)
Increment or decrement the value of a field
in the hash stored at key
by the specified amount.
By using a negative increment value, the value stored at field
in the hash stored at key
is decremented.
If field
or key
does not exist, it is set to 0 before performing the operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
field
|
TEncodable
|
The field in the hash stored at |
required |
amount
|
int
|
The amount by which to increment or decrement the field's value. Use a negative value to decrement. |
required |
Command response
int: The value of the specified field in the hash stored at key
after the increment or decrement.
Source code in glide/async_commands/transaction.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
|
hincrbyfloat(key, field, amount)
Increment or decrement the floating-point value stored at field
in the hash stored at key
by the specified
amount.
By using a negative increment value, the value stored at field
in the hash stored at key
is decremented.
If field
or key
does not exist, it is set to 0 before performing the operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
field
|
TEncodable
|
The field in the hash stored at |
required |
amount
|
float
|
The amount by which to increment or decrement the field's value. Use a negative value to decrement. |
required |
Command response
float: The value of the specified field in the hash stored at key
after the increment as a string.
Source code in glide/async_commands/transaction.py
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
|
hkeys(key)
Returns all field names in the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
Command response
List[bytes]: A list of field names for the hash.
An empty list when the key does not exist.
Source code in glide/async_commands/transaction.py
837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
|
hlen(key)
Returns the number of fields contained in the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
Command response
int: The number of fields in the hash, or 0 when the key does not exist.
If key
holds a value that is not a hash, the transaction fails with an error.
Source code in glide/async_commands/transaction.py
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 |
|
hmget(key, fields)
Retrieve the values associated with specified fields in the hash stored at key
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
fields
|
List[TEncodable]
|
The list of fields in the hash stored at |
required |
Returns:
Type | Description |
---|---|
TTransaction
|
List[Optional[bytes]]: A list of values associated with the given fields, in the same order as they are requested. |
TTransaction
|
For every field that does not exist in the hash, a null value is returned. |
TTransaction
|
If |
Source code in glide/async_commands/transaction.py
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
|
hrandfield(key)
Returns a random field name from the hash value stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
Command response
Optional[bytes]: A random field name from the hash stored at key
.
If the hash does not exist or is empty, None will be returned.
Source code in glide/async_commands/transaction.py
853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 |
|
hrandfield_count(key, count)
Retrieves up to count
random field names from the hash value stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
count
|
int
|
The number of field names to return.
|
required |
Command response
List[bytes]: A list of random field names from the hash.
If the hash does not exist or is empty, the response will be an empty list.
Source code in glide/async_commands/transaction.py
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 |
|
hrandfield_withvalues(key, count)
Retrieves up to count
random field names along with their values from the hash value stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
count
|
int
|
The number of field names to return.
|
required |
Command response
List[List[bytes]]: A list of [field_name, value]
lists, where field_name
is a random field name from the
hash and value
is the associated value of the field name.
If the hash does not exist or is empty, the response will be an empty list.
Source code in glide/async_commands/transaction.py
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 |
|
hscan(key, cursor, match=None, count=None, no_values=False)
Iterates incrementally over a hash.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the set. |
required |
cursor
|
TEncodable
|
The cursor that points to the next iteration of results. A value of "0" indicates the start of the search. |
required |
match
|
Optional[TEncodable]
|
The match filter is applied to the result of the command and will only include
strings or byte strings that match the pattern specified. If the hash is large enough for scan commands to
return only a subset of the hash then there could be a case where the result is empty although there are
items that match the pattern specified. This is due to the default |
None
|
count
|
Optional[int]
|
|
None
|
no_values
|
bool
|
If |
False
|
Returns:
Type | Description |
---|---|
TTransaction
|
List[Union[bytes, List[bytes]]]: An |
TTransaction
|
The first element is always the |
TTransaction
|
returned on the last iteration of the hash. The second element is always an |
TTransaction
|
hash held in |
TTransaction
|
where the value is at even indices and the score is at odd indices. |
TTransaction
|
If |
Source code in glide/async_commands/transaction.py
4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 |
|
hset(key, field_value_map)
Sets the specified fields to their respective values in the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
field_value_map
|
Mapping[TEncodable, TEncodable]
|
A field-value map consisting of fields and their corresponding values to be set in the hash stored at the specified key. |
required |
Command response
int: The number of fields that were added to the hash.
Source code in glide/async_commands/transaction.py
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
|
hsetnx(key, field, value)
Sets field
in the hash stored at key
to value
, only if field
does not yet exist.
If key
does not exist, a new key holding a hash is created.
If field
already exists, this operation has no effect.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
field
|
TEncodable
|
The field to set the value for. |
required |
value
|
TEncodable
|
The value to set. |
required |
Commands response
bool: True if the field was set.
False if the field already existed and was not set.
Source code in glide/async_commands/transaction.py
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
|
hstrlen(key, field)
Returns the string length of the value associated with field
in the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
field
|
TEncodable
|
The field in the hash. |
required |
Commands response
int: The string length.
Returns 0
if field
or key
does not exist.
Source code in glide/async_commands/transaction.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
|
hvals(key)
Returns all values in the hash stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the hash. |
required |
Command response
List[bytes]: A list of values in the hash.
An empty list when the key does not exist.
Source code in glide/async_commands/transaction.py
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 |
|
incr(key)
Increments the number stored at key
by one.
If key
does not exist, it is set to 0 before performing the
operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to increment its value. |
required |
Command response
int: the value of key
after the increment.
Source code in glide/async_commands/transaction.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
|
incrby(key, amount)
Increments the number stored at key
by amount
. If the key does not exist, it is set to 0 before performing
the operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to increment its value. |
required |
amount
|
int)
|
The amount to increment. |
required |
Command response
int: The value of key
after the increment.
Source code in glide/async_commands/transaction.py
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
|
incrbyfloat(key, amount)
Increment the string representing a floating point number stored at key
by amount
.
By using a negative increment value, the value stored at the key
is decremented.
If the key does not exist, it is set to 0 before performing the operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to increment its value. |
required |
amount
|
float)
|
The amount to increment. |
required |
Command response
float: The value of key after the increment.
Source code in glide/async_commands/transaction.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
|
info(sections=None)
Get information and statistics about the server.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sections
|
Optional[List[InfoSection]]
|
A list of InfoSection values specifying which sections of information to retrieve. When no parameter is provided, the default option is assumed. |
None
|
Command response
bytes: Returns a bytes string containing the information for the sections requested.
Source code in glide/async_commands/transaction.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
lastsave()
Returns the Unix time of the last DB save timestamp or startup timestamp if no save was made since then.
See valkey.io for more details.
Command response
int: The Unix time of the last successful DB save.
Source code in glide/async_commands/transaction.py
2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 |
|
lcs(key1, key2)
Returns the longest common subsequence between strings stored at key1 and key2.
Note
This is different than the longest common string algorithm, since matching characters in the two strings do not need to be contiguous.
For instance the LCS between "foo" and "fao" is "fo", since scanning the two strings from left to right, the longest common set of characters is composed of the first "f" and then the "o".
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key1
|
TEncodable
|
The key that stores the first value. |
required |
key2
|
TEncodable
|
The key that stores the second value. |
required |
Command Response
A Bytes String containing the longest common subsequence between the 2 strings.
An empty Bytes String is returned if the keys do not exist or have no common subsequences.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 |
|
lcs_idx(key1, key2, min_match_len=None, with_match_len=False)
Returns the indices and length of the longest common subsequence between strings stored at key1 and key2.
Note
This is different than the longest common string algorithm, since matching characters in the two strings do not need to be contiguous.
For instance the LCS between "foo" and "fao" is "fo", since scanning the two strings from left to right, the longest common set of characters is composed of the first "f" and then the "o".
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key1
|
TEncodable
|
The key that stores the first value. |
required |
key2
|
TEncodable
|
The key that stores the second value. |
required |
min_match_len
|
Optional[int]
|
The minimum length of matches to include in the result. |
None
|
with_match_len
|
Optional[bool]
|
If True, include the length of the substring matched for each substring. |
False
|
Command Response
A Map containing the indices of the longest common subsequence between the 2 strings and the length of the longest common subsequence. The resulting map contains two keys, "matches" and "len":
- "len" is mapped to the length of the longest common subsequence between the 2 strings.
- "matches" is mapped to a three dimensional int array that stores pairs of indices that
represent the location of the common subsequences in the strings held by key1 and key2,
with the length of the match after each matches, if with_match_len is enabled.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 |
|
lcs_len(key1, key2)
Returns the length of the longest common subsequence between strings stored at key1 and key2.
Note
This is different than the longest common string algorithm, since matching characters in the two strings do not need to be contiguous.
For instance the LCS between "foo" and "fao" is "fo", since scanning the two strings from left to right, the longest common set of characters is composed of the first "f" and then the "o".
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key1
|
TEncodable
|
The key that stores the first value. |
required |
key2
|
TEncodable
|
The key that stores the second value. |
required |
Command Response
The length of the longest common subsequence between the 2 strings.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 |
|
lindex(key, index)
Returns the element at index
in the list stored at key
.
The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
index
|
int
|
The index of the element in the list to retrieve. |
required |
Command response
Optional[bytes]: The element at index
in the list stored at key
.
If index
is out of range or if key
does not exist, None is returned.
Source code in glide/async_commands/transaction.py
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 |
|
linsert(key, position, pivot, element)
Inserts element
in the list at key
either before or after the pivot
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
position
|
InsertPosition
|
The relative position to insert into - either |
required |
pivot
|
TEncodable
|
An element of the list. |
required |
element
|
TEncodable
|
The new element to insert. |
required |
Command response
int: The list length after a successful insert operation.
If the key
doesn't exist returns -1
.
If the pivot
wasn't found, returns 0
.
Source code in glide/async_commands/transaction.py
1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 |
|
llen(key)
Get the length of the list stored at key
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
Commands response
int: The length of the list at the specified key.
If key
does not exist, it is interpreted as an empty list and 0 is returned.
Source code in glide/async_commands/transaction.py
1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 |
|
lmove(source, destination, where_from, where_to)
Atomically pops and removes the left/right-most element to the list stored at source
depending on where_from
, and pushes the element at the first/last element of the list
stored at destination
depending on where_to
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
TEncodable
|
The key to the source list. |
required |
destination
|
TEncodable
|
The key to the destination list. |
required |
where_from
|
ListDirection
|
The direction to remove the element from
( |
required |
where_to
|
ListDirection
|
The direction to add the element to
( |
required |
Command response
Optional[bytes]: The popped element.
None
if source
does not exist.
Since: Valkey version 6.2.0.
Source code in glide/async_commands/transaction.py
1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 |
|
lmpop(keys, direction, count=None)
Pops one or more elements from the first non-empty list from the provided keys
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
An array of keys of lists. |
required |
direction
|
ListDirection
|
The direction based on which elements are popped from
( |
required |
count
|
Optional[int]
|
The maximum number of popped elements. If not provided, defaults to popping a single element. |
None
|
Command response
Optional[Mapping[bytes, List[bytes]]]: A map of key
name mapped to an array of popped elements.
None if no elements could be popped.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
|
lolwut(version=None, parameters=None)
Displays a piece of generative computer art and the Valkey version.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
Optional[int]
|
Version of computer art to generate. |
None
|
parameters
|
Optional[List[int]]
|
Additional set of arguments in order to change the output:
|
None
|
Command Response
bytes: A piece of generative computer art along with the current Valkey version.
Source code in glide/async_commands/transaction.py
4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 |
|
lpop(key)
Remove and return the first elements of the list stored at key
.
The command pops a single element from the beginning of the list.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
Command response
Optional[bytes]: The value of the first element.
If key
does not exist, None will be returned.
Source code in glide/async_commands/transaction.py
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 |
|
lpop_count(key, count)
Remove and return up to count
elements from the list stored at key
, depending on the list's length.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
count
|
int
|
The count of elements to pop from the list. |
required |
Command response
Optional[List[bytes]]: A a list of popped elements will be returned depending on the list's length.
If key
does not exist, None will be returned.
Source code in glide/async_commands/transaction.py
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 |
|
lpos(key, element, rank=None, count=None, max_len=None)
Returns the index or indexes of element(s) matching element
in the key
list. If no match is found,
None is returned.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The name of the list. |
required |
element
|
TEncodable
|
The value to search for within the list. |
required |
rank
|
Optional[int]
|
The rank of the match to return. |
None
|
count
|
Optional[int]
|
The number of matches wanted. A |
None
|
max_len
|
Optional[int]
|
The maximum number of comparisons to make between the element and the items
in the list. A |
None
|
Command Response
Union[int, List[int], None]: The index of the first occurrence of element
.
None if element
is not in the list.
With the count
option, a list of indices of matching elements will be returned.
Since: Valkey version 6.0.6.
Source code in glide/async_commands/transaction.py
4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 |
|
lpush(key, elements)
Insert all the specified values at the head of the list stored at key
.
elements
are inserted one after the other to the head of the list, from the leftmost element
to the rightmost element. If key
does not exist, it is created as empty list before performing the push operations.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
elements
|
List[TEncodable]
|
The elements to insert at the head of the list stored at |
required |
Command response
int: The length of the list after the push operations.
Source code in glide/async_commands/transaction.py
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 |
|
lpushx(key, elements)
Inserts all the specified values at the head of the list stored at key
, only if key
exists and holds a list.
If key
is not a list, this performs no operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
elements
|
List[TEncodable]
|
The elements to insert at the head of the list stored at |
required |
Command response
int: The length of the list after the push operation.
Source code in glide/async_commands/transaction.py
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
|
lrange(key, start, end)
Retrieve the specified elements of the list stored at key
within the given range.
The offsets start
and end
are zero-based indexes, with 0 being the first element of the list, 1 being the next
element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list,
with -1 being the last element of the list, -2 being the penultimate, and so on.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
start
|
int
|
The starting point of the range. |
required |
end
|
int
|
The end of the range. |
required |
Command response
List[byte]: A list of elements within the specified range.
If start
exceeds the end
of the list, or if start
is greater than end
, an empty list will be returned.
If end
exceeds the actual end of the list, the range will stop at the actual end of the list.
If key
does not exist an empty list will be returned.
Source code in glide/async_commands/transaction.py
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 |
|
lrem(key, count, element)
Removes the first count
occurrences of elements equal to element
from the list stored at key
.
If count
is positive, it removes elements equal to element
moving from head to tail.
If count
is negative, it removes elements equal to element
moving from tail to head.
If count
is 0 or greater than the occurrences of elements equal to element
, it removes all elements
equal to element
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
count
|
int
|
The count of occurrences of elements equal to |
required |
element
|
TEncodable
|
The element to remove from the list. |
required |
Commands response
int: The number of removed elements.
If key
does not exist, 0 is returned.
Source code in glide/async_commands/transaction.py
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 |
|
lset(key, index, element)
Sets the list element at index
to element
.
The index is zero-based, so 0
means the first element, 1
the second element and so on.
Negative indices can be used to designate elements starting at the tail of the list.
Here, -1
means the last element, -2
means the penultimate and so forth.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
index
|
int
|
The index of the element in the list to be set. |
required |
element
|
TEncodable
|
The new element to set at the specified index. |
required |
Commands response
TOK: A simple OK
response.
Source code in glide/async_commands/transaction.py
1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 |
|
ltrim(key, start, end)
Trim an existing list so that it will contain only the specified range of elements specified.
The offsets start
and end
are zero-based indexes, with 0 being the first element of the list, 1 being the next
element and so on.
These offsets can also be negative numbers indicating offsets starting at the end of the list, with -1 being the last
element of the list, -2 being the penultimate, and so on.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
start
|
int
|
The starting point of the range. |
required |
end
|
int
|
The end of the range. |
required |
Commands response
TOK: A simple "OK" response.
If start
exceeds the end of the list, or if start
is greater than end
, the result will be an empty list
(which causes key
to be removed).
If end
exceeds the actual end of the list, it will be treated like the last element of the list.
If key
does not exist, the response will be "OK" without changes to the database.
Source code in glide/async_commands/transaction.py
1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 |
|
mget(keys)
Retrieve the values of multiple keys.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
A list of keys to retrieve values for. |
required |
Command response
List[Optional[bytes]]: A list of values corresponding to the provided keys. If a key is not found, its corresponding value in the list will be None.
Source code in glide/async_commands/transaction.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
|
mset(key_value_map)
Set multiple keys to multiple values in a single atomic operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameters
|
Mapping[TEncodable, TEncodable]
|
A map of key value pairs. |
required |
Command response
OK: a simple OK response.
Source code in glide/async_commands/transaction.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
|
msetnx(key_value_map)
Sets multiple keys to values if the key does not exist. The operation is atomic, and if one or more keys already exist, the entire operation fails.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key_value_map
|
Mapping[TEncodable, TEncodable]
|
A key-value map consisting of keys and their respective values to set. |
required |
Commands response
bool: True if all keys were set.
False if no key was set.
Source code in glide/async_commands/transaction.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
object_encoding(key)
Returns the internal encoding for the Valkey object stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The |
required |
Command response
Optional[bytes]: If key
exists, returns the internal encoding of the object stored at
key
as a bytes string.
Otherwise, returns None.
Source code in glide/async_commands/transaction.py
4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 |
|
object_freq(key)
Returns the logarithmic access frequency counter of a Valkey object stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the object to get the logarithmic access frequency counter of. |
required |
Command response
Optional[int]: If key
exists, returns the logarithmic access frequency counter of the object stored at key
as
an integer.
Otherwise, returns None.
Source code in glide/async_commands/transaction.py
4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 |
|
object_idletime(key)
Returns the time in seconds since the last access to the value stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the object to get the idle time of. |
required |
Command response
Optional[int]: If key
exists, returns the idle time in seconds.
Otherwise, returns None.
Source code in glide/async_commands/transaction.py
4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 |
|
object_refcount(key)
Returns the reference count of the object stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the object to get the reference count of. |
required |
Command response
Optional[int]: If key
exists, returns the reference count of the object stored at key
as an integer.
Otherwise, returns None.
Source code in glide/async_commands/transaction.py
4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 |
|
persist(key)
Remove the existing timeout on key
, turning the key from volatile (a key with an expire set) to
persistent (a key that will never expire as no timeout is associated).
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to remove the existing timeout on. |
required |
Commands response
bool: False if key
does not exist or does not have an associated timeout.
True if the timeout has been removed.
Source code in glide/async_commands/transaction.py
1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 |
|
pexpire(key, milliseconds, option=None)
Sets a timeout on key
in milliseconds. After the timeout has expired, the key will automatically be deleted.
If key
already has an existing expire set, the time to live is updated to the new value.
If milliseconds
is a non-positive number, the key will be deleted rather than expired.
The timeout will only be cleared by commands that delete or overwrite the contents of key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to set a timeout on. |
required |
milliseconds
|
int
|
The timeout in milliseconds. |
required |
option
|
Optional[ExpireOptions]
|
The expire option. |
None
|
Commands response
bool: True
if the timeout was set.
False
if the timeout was not set (e.g., the key doesn't exist or the operation
is skipped due to the provided arguments).
Source code in glide/async_commands/transaction.py
1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 |
|
pexpireat(key, unix_milliseconds, option=None)
Sets a timeout on key
using an absolute Unix timestamp in milliseconds (milliseconds since January 1, 1970) instead
of specifying the number of milliseconds.
A timestamp in the past will delete the key immediately. After the timeout has expired, the key will automatically be
deleted.
If key
already has an existing expire set, the time to live is updated to the new value.
The timeout will only be cleared by commands that delete or overwrite the contents of key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to set a timeout on. |
required |
unix_milliseconds
|
int
|
The timeout in an absolute Unix timestamp in milliseconds. |
required |
option
|
Optional[ExpireOptions]
|
The expire option. |
None
|
Commands response
bool: True
if the timeout was set.
False
if the timeout was not set (e.g., the key doesn't exist or the operation
is skipped due to the provided arguments).
Source code in glide/async_commands/transaction.py
1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 |
|
pexpiretime(key)
Returns the absolute Unix timestamp (since January 1, 1970) at which
the given key
will expire, in milliseconds.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The |
required |
Commands response
int: The expiration Unix timestamp in milliseconds.
-2 if key
does not exist.
-1 if key
exists but has no associated expiration.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 |
|
pfadd(key, elements)
Adds all elements to the HyperLogLog data structure stored at the specified key
.
Creates a new structure if the key
does not exist.
When no elements are provided, and key
exists and is a HyperLogLog, then no operation is performed.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the HyperLogLog data structure to add elements into. |
required |
elements
|
List[TEncodable]
|
A list of members to add to the HyperLogLog stored at |
required |
Commands response
int: If the HyperLogLog is newly created, or if the HyperLogLog approximated cardinality is altered, then returns 1.
Otherwise, returns 0.
Source code in glide/async_commands/transaction.py
4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 |
|
pfcount(keys)
Estimates the cardinality of the data stored in a HyperLogLog structure for a single key or calculates the combined cardinality of multiple keys by merging their HyperLogLogs temporarily.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the HyperLogLog data structures to be analyzed. |
required |
Command response
int: The approximated cardinality of given HyperLogLog data structures. The cardinality of a key that does not exist is 0.
Source code in glide/async_commands/transaction.py
4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 |
|
pfmerge(destination, source_keys)
Merges multiple HyperLogLog values into a unique value. If the destination variable exists, it is treated as one of the source HyperLogLog data sets, otherwise a new HyperLogLog is created.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key of the destination HyperLogLog where the merged data sets will be stored. |
required |
source_keys
|
List[TEncodable]
|
The keys of the HyperLogLog structures to be merged. |
required |
Command response
OK: A simple OK response.
Source code in glide/async_commands/transaction.py
4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 |
|
ping(message=None)
Ping the server.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
Optional[TEncodable]
|
An optional message to include in the PING command. If not provided, |
None
|
Command response
bytes: b"PONG" if message
is not provided, otherwise return a copy of message
.
Source code in glide/async_commands/transaction.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
|
pttl(key)
Returns the remaining time to live of key
that has a timeout, in milliseconds.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to return its timeout. |
required |
Commands Response
int: TTL in milliseconds.
-2 if key
does not exist.
-1 if key
exists but has no associated expire.
Source code in glide/async_commands/transaction.py
1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 |
|
pubsub_channels(pattern=None)
Lists the currently active channels.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pattern
|
Optional[TEncodable]
|
A glob-style pattern to match active channels. If not provided, all active channels are returned. |
None
|
Command response
List[bytes]: A list of currently active channels matching the given pattern.
If no pattern is specified, all active channels are returned.
Source code in glide/async_commands/transaction.py
5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 |
|
pubsub_numpat()
Returns the number of unique patterns that are subscribed to by clients.
Note
This is the total number of unique patterns all the clients are subscribed to, not the count of clients subscribed to patterns.
See valkey.io for details.
Command response
int: The number of unique patterns.
Source code in glide/async_commands/transaction.py
5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 |
|
pubsub_numsub(channels=None)
Returns the number of subscribers (exclusive of clients subscribed to patterns) for the specified 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 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 channel names and values are the number of subscribers.
Source code in glide/async_commands/transaction.py
5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 |
|
random_key()
Returns a random existing key name.
See valkey.io for more details.
Command response
Optional[bytes]: A random existing key name.
Source code in glide/async_commands/transaction.py
4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 |
|
rename(key, new_key)
Renames key
to new_key
.
If newkey
already exists it is overwritten.
Note
In Cluster mode, both key
and newkey
must be in the same hash slot,
meaning that in practice only keys that have the same hash tag can be reliably renamed in cluster.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable)
|
The key to rename. |
required |
new_key
|
TEncodable)
|
The new name of the key. |
required |
Command response
OK: If the key
was successfully renamed, return "OK".
If key
does not exist, the transaction fails with an error.
Source code in glide/async_commands/transaction.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
renamenx(key, new_key)
Renames key
to new_key
if new_key
does not yet exist.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to rename. |
required |
new_key
|
TEncodable
|
The new key name. |
required |
Command response
bool: True if key
was renamed to new_key
.
False if new_key
already exists.
Source code in glide/async_commands/transaction.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
restore(key, ttl, value, replace=False, absttl=False, idletime=None, frequency=None)
Create a key
associated with a value
that is obtained by deserializing the provided
serialized value
obtained via dump
.
See valkey.io for more details.
Note
IDLETIME
and FREQ
modifiers cannot be set at the same time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The |
required |
ttl
|
int
|
The expiry time (in milliseconds). If |
required |
replace
|
bool
|
Set to |
False
|
absttl
|
bool
|
Set to |
False
|
idletime
|
Optional[int]
|
Set the |
None
|
frequency
|
Optional[int]
|
Set the |
None
|
Command response
TOK: A simple "OK" response.
Source code in glide/async_commands/transaction.py
2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 |
|
rpop(key, count=None)
Removes and returns the last elements of the list stored at key
.
The command pops a single element from the end of the list.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
Commands response
Optional[bytes]: The value of the last element.
If key
does not exist, None will be returned.
Source code in glide/async_commands/transaction.py
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 |
|
rpop_count(key, count)
Removes and returns up to count
elements from the list stored at key
, depending on the list's length.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
count
|
int
|
The count of elements to pop from the list. |
required |
Commands response
Optional[List[bytes]: A list of popped elements will be returned depending on the list's length.
If key
does not exist, None will be returned.
Source code in glide/async_commands/transaction.py
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 |
|
rpush(key, elements)
Inserts all the specified values at the tail of the list stored at key
.
elements
are inserted one after the other to the tail of the list, from the leftmost element
to the rightmost element. If key
does not exist, it is created as empty list before performing the push operations.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
elements
|
List[TEncodable]
|
The elements to insert at the tail of the list stored at |
required |
Command response
int: The length of the list after the push operations.
If key
holds a value that is not a list, the transaction fails.
Source code in glide/async_commands/transaction.py
1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 |
|
rpushx(key, elements)
Inserts all the specified values at the tail of the list stored at key
, only if key
exists and holds a list.
If key
is not a list, this performs no operation.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list. |
required |
elements
|
List[TEncodable]
|
The elements to insert at the tail of the list stored at |
required |
Command response
int: The length of the list after the push operation.
Source code in glide/async_commands/transaction.py
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 |
|
sadd(key, members)
Add specified members to the set stored at key
.
Specified members that are already a member of this set are ignored.
If key
does not exist, a new set is created before adding members
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key where members will be added to its set. |
required |
members
|
List[TEncodable]
|
A list of members to add to the set stored at key. |
required |
Command response
int: The number of members that were added to the set, excluding members already present.
Source code in glide/async_commands/transaction.py
1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 |
|
scard(key)
Retrieve the set cardinality (number of elements) of the set stored at key
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key from which to retrieve the number of set members. |
required |
Commands response
int: The cardinality (number of elements) of the set.
Returns 0
if the key does not exist.
Source code in glide/async_commands/transaction.py
1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 |
|
sdiff(keys)
Computes the difference between the first set and all the successive sets in keys
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sets to diff. |
required |
Command response
Set[bytes]: A set of elements representing the difference between the sets.
If any of the keys in keys
do not exist, they are treated as empty sets.
Source code in glide/async_commands/transaction.py
1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 |
|
sdiffstore(destination, keys)
Stores the difference between the first set and all the successive sets in keys
into a new set at
destination
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key of the destination set. |
required |
keys
|
List[TEncodable]
|
The keys of the sets to diff. |
required |
Command response
int: The number of elements in the resulting set.
Source code in glide/async_commands/transaction.py
1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 |
|
set(key, value, conditional_set=None, expiry=None, return_old_value=False)
Set the given key with the given value. Return value is dependent on the passed options.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
the key to store. |
required |
value
|
TEncodable
|
the value to store with the given key. |
required |
conditional_set
|
Optional[ConditionalChange]
|
set the key only if the given condition is met.
Equivalent to [ |
None
|
expiry
|
Optional[ExpirySet]
|
set expiriation to the given key.
Equivalent to [ |
None
|
return_old_value
|
bool
|
Return the old value stored at key, or None if key did not exist.
An error is returned and SET aborted if the value stored at key is not a string.
Equivalent to |
False
|
Command response
Optional[bytes]: If the value is successfully set, return OK.
If value isn't set because of only_if_exists or only_if_does_not_exist conditions, return None.
If return_old_value is set, return the old value as a bytes string.
Example
Set "foo" to "bar" only if "foo" already exists, and set the key expiration to 5 seconds:
connection.set("foo", "bar", conditional_set=ConditionalChange.ONLY_IF_EXISTS, ... expiry=Expiry(ExpiryType.SEC, 5))
Source code in glide/async_commands/transaction.py
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 |
|
setbit(key, offset, value)
Sets or clears the bit at offset
in the string value stored at key
. The offset
is a zero-based index,
with 0
being the first element of the list, 1
being the next element, and so on. The offset
must be less
than 2^32
and greater than or equal to 0
. If a key is non-existent then the bit at offset
is set to
value
and the preceding bits are set to 0
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the string. |
required |
offset
|
int
|
The index of the bit to be set. |
required |
value
|
int
|
The bit value to set at |
required |
Command response
int: The bit value that was previously stored at offset
.
Source code in glide/async_commands/transaction.py
4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 |
|
setrange(key, offset, value)
Overwrites part of the string stored at key
, starting at the specified
offset
, for the entire length of value
.
If the offset
is larger than the current length of the string at key
,
the string is padded with zero bytes to make offset
fit. Creates the key
if it doesn't exist.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the string to update. |
required |
offset
|
int
|
The position in the string where |
required |
value
|
TEncodable
|
The value written with |
required |
Command response
int: The length of the value stored at key
after it was modified.
Source code in glide/async_commands/transaction.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
|
sinter(keys)
Gets the intersection of all the given sets.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sets. |
required |
Command response
Set[bytes]: A set of members which are present in all given sets.
If one or more sets do not exist, an empty set will be returned.
Source code in glide/async_commands/transaction.py
1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 |
|
sintercard(keys, limit=None)
Gets the cardinality of the intersection of all the given sets.
Optionally, a limit
can be specified to stop the computation early if the intersection
cardinality reaches the specified limit.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
A list of keys representing the sets to intersect. |
required |
limit
|
Optional[int]
|
An optional limit to the maximum number of intersecting elements to count. If specified, the computation stops as soon as the cardinality reaches this limit. |
None
|
Command response
int: The number of elements in the resulting set of the intersection.
Source code in glide/async_commands/transaction.py
1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 |
|
sinterstore(destination, keys)
Stores the members of the intersection of all given sets specified by keys
into a new set at destination
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key of the destination set. |
required |
keys
|
List[TEncodable]
|
The keys from which to retrieve the set members. |
required |
Command response
int: The number of elements in the resulting set.
Source code in glide/async_commands/transaction.py
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 |
|
sismember(key, member)
Returns if member
is a member of the set stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the set. |
required |
member
|
TEncodable
|
The member to check for existence in the set. |
required |
Commands response
bool: True if the member exists in the set, False otherwise.
If key
doesn't exist, it is treated as an empty set and the command returns False.
Source code in glide/async_commands/transaction.py
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 |
|
smembers(key)
Retrieve all the members of the set value stored at key
.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key from which to retrieve the set members. |
required |
Commands response
Set[bytes]: A set of all members of the set.
If key
does not exist an empty list will be returned.
Source code in glide/async_commands/transaction.py
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 |
|
smismember(key, members)
Checks whether each member is contained in the members of the set stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the set to check. |
required |
members
|
List[TEncodable]
|
A list of members to check for existence in the set. |
required |
Command response
List[bool]: A list of bool values, each indicating if the respective member exists in the set.
Source code in glide/async_commands/transaction.py
1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 |
|
smove(source, destination, member)
Moves member
from the set at source
to the set at destination
, removing it from the source set. Creates a
new destination set if needed. The operation is atomic.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
TEncodable
|
The key of the set to remove the element from. |
required |
destination
|
TEncodable
|
The key of the set to add the element to. |
required |
member
|
TEncodable
|
The set element to move. |
required |
Command response
bool: True on success.
False if the source
set does not exist or the element is not a member of the source set.
Source code in glide/async_commands/transaction.py
1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 |
|
sort(key, by_pattern=None, limit=None, get_patterns=None, order=None, alpha=None)
Sorts the elements in the list, set, or sorted set at key
and returns the result.
The sort
command can be used to sort elements based on different criteria and apply transformations on sorted
elements.
To store the result into a new key, see sort_store
.
See valkey.io for more details.
Note
When in cluster mode, key
, and any patterns specified in by_pattern
or get_patterns
must map to the same hash slot. The use of by_pattern
and get_patterns
in cluster mode is supported
only since Valkey version 8.0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list, set, or sorted set to be sorted. |
required |
by_pattern
|
Optional[TEncodable]
|
A pattern to sort by external keys instead of by the elements stored at the key
themselves.
The pattern should contain an asterisk (*) as a placeholder for the element values, where the value
from the key replaces the asterisk to create the key name. For example, if |
None
|
limit
|
Optional[Limit]
|
Limiting the range of the query by setting offset and result count. See |
None
|
get_patterns
|
Optional[List[TEncodable]]
|
A pattern used to retrieve external keys' values, instead of the
elements at |
None
|
order
|
Optional[OrderBy]
|
Specifies the order to sort the elements.
Can be |
None
|
alpha
|
Optional[bool]
|
When |
None
|
Command response
List[Optional[bytes]]: Returns a list of sorted elements.
Source code in glide/async_commands/transaction.py
5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 |
|
sort_ro(key, by_pattern=None, limit=None, get_patterns=None, order=None, alpha=None)
Sorts the elements in the list, set, or sorted set at key
and returns the result.
The sort_ro
command can be used to sort elements based on different criteria and apply transformations
on sorted elements.
This command is routed depending on the client's ReadFrom
strategy.
See valkey.io for more details.
Note
When in cluster mode, key
, and any patterns specified in by_pattern
or get_patterns
must map to the same hash slot. The use of by_pattern
and get_patterns
in cluster mode is supported
only since Valkey version 8.0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list, set, or sorted set to be sorted. |
required |
by_pattern
|
Optional[TEncodable]
|
A pattern to sort by external keys instead of by the elements stored at the key
themselves.
The pattern should contain an asterisk (*) as a placeholder for the element values, where the value
from the key replaces the asterisk to create the key name. For example, if |
None
|
limit
|
Optional[Limit]
|
Limiting the range of the query by setting offset and result count. See |
None
|
get_patterns
|
Optional[List[TEncodable]]
|
A pattern used to retrieve external keys' values, instead of the
elements at |
None
|
order
|
Optional[OrderBy]
|
Specifies the order to sort the elements.
Can be |
None
|
alpha
|
Optional[bool]
|
When |
None
|
Command response
List[Optional[bytes]]: Returns a list of sorted elements.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 |
|
sort_store(key, destination, by_pattern=None, limit=None, get_patterns=None, order=None, alpha=None)
Sorts the elements in the list, set, or sorted set at key
and stores the result in store
.
The sort
command can be used to sort elements based on different criteria, apply transformations on sorted elements,
and store the result in a new key.
To get the sort result without storing it into a key, see sort
.
See valkey.io for more details.
Note
When in cluster mode, key
, destination
, and any patterns specified in by_pattern
or get_patterns
must map to the same hash slot. The use of by_pattern
and get_patterns
in cluster mode is supported
only since Valkey version 8.0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the list, set, or sorted set to be sorted. |
required |
destination
|
TEncodable
|
The key where the sorted result will be stored. |
required |
by_pattern
|
Optional[TEncodable]
|
A pattern to sort by external keys instead of by the elements stored at the key
themselves.
The pattern should contain an asterisk (*) as a placeholder for the element values, where the value
from the key replaces the asterisk to create the key name. For example, if |
None
|
limit
|
Optional[Limit]
|
Limiting the range of the query by setting offset and result count. See |
None
|
get_patterns
|
Optional[List[TEncodable]]
|
A pattern used to retrieve external keys' values, instead of the
elements at |
None
|
order
|
Optional[OrderBy]
|
Specifies the order to sort the elements.
Can be |
None
|
alpha
|
Optional[bool]
|
When |
None
|
Command response
int: The number of elements in the sorted key stored at store
.
Source code in glide/async_commands/transaction.py
5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 |
|
spop(key)
Removes and returns one random member from the set stored at key
.
See valkey.io for more details.
To pop multiple members, see spop_count
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the set. |
required |
Commands response
Optional[bytes]: The value of the popped member.
If key
does not exist, None will be returned.
Source code in glide/async_commands/transaction.py
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 |
|
spop_count(key, count)
Removes and returns up to count
random members from the set stored at key
, depending on the set's length.
See valkey.io for more details.
To pop a single member, see spop
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the set. |
required |
count
|
int
|
The count of the elements to pop from the set. |
required |
Commands response
Set[bytes]: A set of popped elements will be returned depending on the set's length.
If key
does not exist, an empty set will be returned.
Source code in glide/async_commands/transaction.py
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 |
|
srandmember(key)
Returns a random element from the set value stored at 'key'.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key from which to retrieve the set member. |
required |
Command Response
bytes: A random element from the set.
None
if 'key' does not exist.
Source code in glide/async_commands/transaction.py
4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 |
|
srandmember_count(key, count)
Returns one or more random elements from the set value stored at 'key'.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
count
|
int
|
The number of members to return.
|
required |
Command Response
List[TEncodable]: A list of members from the set.
If the set does not exist or is empty, the response will be an empty list.
Source code in glide/async_commands/transaction.py
4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 |
|
srem(key, members)
Remove specified members from the set stored at key
.
Specified members that are not a member of this set are ignored.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key from which members will be removed. |
required |
members
|
List[TEncodable]
|
A list of members to remove from the set stored at key. |
required |
Commands response
int: The number of members that were removed from the set, excluding non-existing members.
If key
does not exist, it is treated as an empty set and this command returns 0.
Source code in glide/async_commands/transaction.py
1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 |
|
sscan(key, cursor, match=None, count=None)
Iterates incrementally over a set.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the set. |
required |
cursor
|
TEncodable
|
The cursor that points to the next iteration of results. A value of "0" indicates the start of the search. |
required |
match
|
Optional[TEncodable]
|
The match filter is applied to the result of the command and will only include
strings or bytes strings that match the pattern specified. If the set is large enough for scan commands to
return only a subset of the set then there could be a case where the result is empty although there are items
that match the pattern specified. This is due to the default |
None
|
count
|
Optional[int]
|
|
None
|
Command Response
List[Union[bytes, List[bytes]]]: An Array
of the cursor
and the subset of the set held by key
.
The first element is always the cursor
for the next iteration of results. 0
will be the cursor
returned on the last iteration of the set. The second element is always an Array
of the subset of the
set held in key
.
Source code in glide/async_commands/transaction.py
4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 |
|
strlen(key)
Get the length of the string value stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to return its length. |
required |
Commands response
int: The length of the string value stored at key
.
If key
does not exist, it is treated as an empty string and 0 is returned.
Source code in glide/async_commands/transaction.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
sunion(keys)
Gets the union of all the given sets.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sets. |
required |
Commands response
Set[bytes]: A set of members which are present in at least one of the given sets.
If none of the sets exist, an empty set will be returned.
Source code in glide/async_commands/transaction.py
1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 |
|
sunionstore(destination, keys)
Stores the members of the union of all given sets specified by keys
into a new set at destination
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key of the destination set. |
required |
keys
|
List[TEncodable]
|
The keys from which to retrieve the set members. |
required |
Command response
int: The number of elements in the resulting set.
Source code in glide/async_commands/transaction.py
1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 |
|
touch(keys)
Updates the last access time of specified keys.
See valkey.io for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys to update last access time. |
required |
Commands response
int: The number of keys that were updated, a key is ignored if it doesn't exist.
Source code in glide/async_commands/transaction.py
446 447 448 449 450 451 452 453 454 455 456 457 458 |
|
ttl(key)
Returns the remaining time to live of key
that has a timeout.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to return its timeout. |
required |
Commands response
int: TTL in seconds.
-2 if key
does not exist.
-1 if key
exists but has no associated expire.
Source code in glide/async_commands/transaction.py
1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 |
|
type(key)
Returns the string representation of the type of the value stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key to check its data type. |
required |
Commands response
bytes: If the key exists, the type of the stored value is returned.
Otherwise, a "none" string is returned.
Source code in glide/async_commands/transaction.py
2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 |
|
unlink(keys)
Unlink (delete) multiple keys from the database.
A key is ignored if it does not exist.
This command, similar to DEL, removes specified keys and ignores non-existent ones.
However, this command does not block the server, while DEL <[valkey.io](https://valkey.io/commands/del>
_) does.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The list of keys to unlink. |
required |
Commands response
int: The number of keys that were unlinked.
Source code in glide/async_commands/transaction.py
1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 |
|
wait(numreplicas, timeout)
Returns the number of replicas that acknowledged the write commands sent by the current client before this command, both in the case where the specified number of replicas are reached, or when the timeout is reached.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
numreplicas
|
int
|
The number of replicas to reach. |
required |
timeout
|
int
|
The timeout value specified in milliseconds. |
required |
Command Response
bytes: The number of replicas reached by all the writes performed in the context of the current connection.
Source code in glide/async_commands/transaction.py
4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 |
|
xack(key, group_name, ids)
Removes one or multiple messages from the Pending Entries List (PEL) of a stream consumer group. This command should be called on pending messages so that such messages do not get processed again by the consumer group.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
ids
|
List[TEncodable]
|
The stream entry IDs to acknowledge and consume for the given consumer group. |
required |
Command response
int: The number of messages that were successfully acknowledged.
Source code in glide/async_commands/transaction.py
2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 |
|
xadd(key, values, options=StreamAddOptions())
Adds an entry to the specified stream stored at key
. If the key
doesn't exist, the stream is created.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
values
|
List[Tuple[TEncodable, TEncodable]]
|
List[Tuple[TEncodable, TEncodable]]: Field-value pairs to be added to the entry. |
required |
options
|
Optional[StreamAddOptions]
|
Additional options for adding entries to the stream.
Default to None. See |
StreamAddOptions()
|
Commands response
bytes: The id of the added entry.
None if options.make_stream
is set to False and no stream with the matching key
exists.
Source code in glide/async_commands/transaction.py
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 |
|
xautoclaim(key, group_name, consumer_name, min_idle_time_ms, start, count=None)
Transfers ownership of pending stream entries that match the specified criteria.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
consumer_name
|
TEncodable
|
The consumer name. |
required |
min_idle_time_ms
|
int
|
Filters the claimed entries to those that have been idle for more than the specified value. |
required |
start
|
TEncodable
|
Filters the claimed entries to those that have an ID equal or greater than the specified value. |
required |
count
|
Optional[int]
|
Limits the number of claimed entries to the specified value. |
None
|
Command response
List[Union[str, Mapping[bytes, List[List[bytes]]], List[bytes]]]: A list containing the following elements:
- A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is equivalent
to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was
scanned.
- A mapping of the claimed entries, with the keys being the claimed entry IDs and the values being a
2D list of the field-value pairs in the format `[[field1, value1], [field2, value2], ...]`.
- If you are using Valkey 7.0.0 or above, the response list will also include a list containing the
message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are
deleted from the Pending Entries List.
Since: Valkey version 6.2.0.
Source code in glide/async_commands/transaction.py
2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 |
|
xautoclaim_just_id(key, group_name, consumer_name, min_idle_time_ms, start, count=None)
Transfers ownership of pending stream entries that match the specified criteria. This command uses the JUSTID argument to further specify that the return value should contain a list of claimed IDs without their field-value info.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
consumer_name
|
TEncodable
|
The consumer name. |
required |
min_idle_time_ms
|
int
|
Filters the claimed entries to those that have been idle for more than the specified value. |
required |
start
|
TEncodable
|
Filters the claimed entries to those that have an ID equal or greater than the specified value. |
required |
count
|
Optional[int]
|
Limits the number of claimed entries to the specified value. |
None
|
Command response
List[Union[bytes, List[bytes]]]: A list containing the following elements:
- A stream ID to be used as the start argument for the next call to `XAUTOCLAIM`. This ID is equivalent
to the next ID in the stream after the entries that were scanned, or "0-0" if the entire stream was
scanned.
- A list of the IDs for the claimed entries.
- If you are using Valkey 7.0.0 or above, the response list will also include a list containing the
message IDs that were in the Pending Entries List but no longer exist in the stream. These IDs are
deleted from the Pending Entries List.
Since: Valkey version 6.2.0.
Source code in glide/async_commands/transaction.py
2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 |
|
xclaim(key, group, consumer, min_idle_time_ms, ids, options=None)
Changes the ownership of a pending message.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group
|
TEncodable
|
The consumer group name. |
required |
consumer
|
TEncodable
|
The group consumer. |
required |
min_idle_time_ms
|
int
|
The minimum idle time for the message to be claimed. |
required |
ids
|
List[TEncodable]
|
A array of entry ids. |
required |
options
|
Optional[StreamClaimOptions]
|
Stream claim options. |
None
|
Returns:
Type | Description |
---|---|
TTransaction
|
A Mapping of message entries with the format:: {"entryId": [["entry", "data"], ...], ...} |
TTransaction
|
that are claimed by the consumer. |
Source code in glide/async_commands/transaction.py
5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 |
|
xclaim_just_id(key, group, consumer, min_idle_time_ms, ids, options=None)
Changes the ownership of a pending message. This function returns a List with only the message/entry IDs, and is equivalent to using JUSTID in the Valkey API.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group
|
TEncodable
|
The consumer group name. |
required |
consumer
|
TEncodable
|
The group consumer. |
required |
min_idle_time_ms
|
int
|
The minimum idle time for the message to be claimed. |
required |
ids
|
List[TEncodable]
|
A array of entry ids. |
required |
options
|
Optional[StreamClaimOptions]
|
Stream claim options. |
None
|
Returns:
Type | Description |
---|---|
TTransaction
|
A List of message ids claimed by the consumer. |
Source code in glide/async_commands/transaction.py
5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 |
|
xdel(key, ids)
Removes the specified entries by id from a stream, and returns the number of entries deleted.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
ids
|
List[TEncodable]
|
An array of entry ids. |
required |
Command response
int: The number of entries removed from the stream. This number may be less than the number of entries in
ids
, if the specified ids
don't exist in the stream.
Source code in glide/async_commands/transaction.py
2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 |
|
xgroup_create(key, group_name, group_id, options=None)
Creates a new consumer group uniquely identified by group_name
for the stream stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The newly created consumer group name. |
required |
group_id
|
TEncodable
|
The stream entry ID that specifies the last delivered entry in the stream from the new group’s perspective. The special ID "$" can be used to specify the last entry in the stream. |
required |
options
|
Optional[StreamGroupOptions]
|
Options for creating the stream group. |
None
|
Command response
TOK: A simple "OK" response.
Source code in glide/async_commands/transaction.py
2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 |
|
xgroup_create_consumer(key, group_name, consumer_name)
Creates a consumer named consumer_name
in the consumer group group_name
for the stream stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
consumer_name
|
TEncodable
|
The newly created consumer. |
required |
Command response
bool: True if the consumer is created.
Otherwise, returns False.
Source code in glide/async_commands/transaction.py
2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 |
|
xgroup_del_consumer(key, group_name, consumer_name)
Deletes a consumer named consumer_name
in the consumer group group_name
for the stream stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
consumer_name
|
TEncodable
|
The consumer to delete. |
required |
Command response
int: The number of pending messages the consumer
had before it was deleted.
Source code in glide/async_commands/transaction.py
2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 |
|
xgroup_destroy(key, group_name)
Destroys the consumer group group_name
for the stream stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name to delete. |
required |
Command response
bool: True if the consumer group was destroyed.
Otherwise, returns False.
Source code in glide/async_commands/transaction.py
2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 |
|
xgroup_set_id(key, group_name, stream_id, entries_read_id=None)
Set the last delivered ID for a consumer group.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
stream_id
|
TEncodable
|
The stream entry ID that should be set as the last delivered ID for the consumer group. |
required |
entries_read_id
|
Optional[str]
|
An arbitrary ID (that isn't the first ID, last ID, or the zero ID ("0-0")) used to find out how many entries are between the arbitrary ID (excluding it) and the stream's last entry. This argument can only be specified if you are using Valkey version 7.0.0 or above. |
None
|
Command response
TOK: A simple "OK" response.
Source code in glide/async_commands/transaction.py
2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 |
|
xinfo_consumers(key, group_name)
Returns the list of all consumers and their attributes for the given consumer group of the stream stored at
key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
Command response
List[Mapping[bytes, Union[bytes, int]]]: A list of mappings, where each mapping contains the attributes of a
consumer for the given consumer group of the stream at key
.
Source code in glide/async_commands/transaction.py
2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 |
|
xinfo_groups(key)
Returns the list of all consumer groups and their attributes for the stream stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
Command response
List[Mapping[bytes, Union[bytes, int, None]]]: A list of mappings, where each mapping represents the
attributes of a consumer group for the stream at key
.
Source code in glide/async_commands/transaction.py
2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 |
|
xinfo_stream(key)
Returns information about the stream stored at key
. To get more detailed information, use xinfo_stream_full
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
Command response
TXInfoStreamResponse: A mapping of stream information for the given key
.
Source code in glide/async_commands/transaction.py
2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 |
|
xinfo_stream_full(key, count=None)
Returns verbose information about the stream stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
count
|
Optional[int]
|
The number of stream and PEL entries that are returned. A value of |
None
|
Command response
TXInfoStreamFullResponse: A mapping of detailed stream information for the given key
.
Source code in glide/async_commands/transaction.py
2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 |
|
xlen(key)
Returns the number of entries in the stream stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
Command response
int: The number of entries in the stream.
If key
does not exist, returns 0.
Source code in glide/async_commands/transaction.py
2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 |
|
xpending(key, group_name)
Returns stream message summary information for pending messages for the given consumer group.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
Command response
List[Union[int, bytes, List[List[bytes]], None]]: A list that includes the summary of pending messages, with the
format [num_group_messages, start_id, end_id, [[consumer_name, num_consumer_messages]]]
, where:
- `num_group_messages`: The total number of pending messages for this consumer group.
- `start_id`: The smallest ID among the pending messages.
- `end_id`: The greatest ID among the pending messages.
- `[[consumer_name, num_consumer_messages]]`: A 2D list of every consumer in the consumer group with at
least one pending message, and the number of pending messages it has.
If there are no pending messages for the given consumer group, [0, None, None, None]
will be returned.
Source code in glide/async_commands/transaction.py
2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 |
|
xpending_range(key, group_name, start, end, count, options=None)
Returns an extended form of stream message information for pending messages matching a given range of IDs.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
start
|
StreamRangeBound
|
The starting stream ID bound for the range.
|
required |
end
|
StreamRangeBound
|
The ending stream ID bound for the range.
|
required |
count
|
int
|
Limits the number of messages returned. |
required |
options
|
Optional[StreamPendingOptions]
|
The stream pending options. |
None
|
Command response
List[List[Union[bytes, int]]]: A list of lists, where each inner list is a length 4 list containing extended
message information with the format [[id, consumer_name, time_elapsed, num_delivered]]
, where:
- `id`: The ID of the message.
- `consumer_name`: The name of the consumer that fetched the message and has still to acknowledge it. We
call it the current owner of the message.
- `time_elapsed`: The number of milliseconds that elapsed since the last time this message was delivered
to this consumer.
- `num_delivered`: The number of times this message was delivered.
Source code in glide/async_commands/transaction.py
2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 |
|
xrange(key, start, end, count=None)
Returns stream entries matching a given range of IDs.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
start
|
StreamRangeBound
|
The starting stream ID bound for the range.
|
required |
end
|
StreamRangeBound
|
The ending stream ID bound for the range.
|
required |
count
|
Optional[int]
|
An optional argument specifying the maximum count of stream entries to return.
If |
None
|
Command response
Optional[Mapping[bytes, List[List[bytes]]]]: A mapping of stream IDs to stream entry data, where entry data is a
list of pairings with format [[field, entry], [field, entry], ...]
.
Returns None if the range arguments are not applicable.
Source code in glide/async_commands/transaction.py
2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 |
|
xread(keys_and_ids, options=None)
Reads entries from the given streams.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys_and_ids
|
Mapping[TEncodable, TEncodable]
|
A mapping of stream keys to stream entry IDs to read from. |
required |
options
|
Optional[StreamReadOptions]
|
Options detailing how to read the stream. |
None
|
Command response
Optional[Mapping[bytes, Mapping[bytes, List[List[bytes]]]]]: A mapping of stream keys, to a mapping of stream IDs,
to a list of pairings with format [[field, entry], [field, entry], ...]
.
None will be returned under the following conditions:
- All key-ID pairs in `keys_and_ids` have either a non-existing key or a non-existing ID,
or there are no entries after the given ID.
- The `BLOCK` option is specified and the timeout is hit.
Source code in glide/async_commands/transaction.py
2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 |
|
xreadgroup(keys_and_ids, group_name, consumer_name, options=None)
Reads entries from the given streams owned by a consumer group.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys_and_ids
|
Mapping[TEncodable, TEncodable]
|
A mapping of stream keys to stream entry IDs to read from.
Use the special entry ID of |
required |
group_name
|
TEncodable
|
The consumer group name. |
required |
consumer_name
|
TEncodable
|
The consumer name. The consumer will be auto-created if it does not already exist. |
required |
options
|
Optional[StreamReadGroupOptions]
|
Options detailing how to read the stream. |
None
|
Command response
Optional[Mapping[bytes, Mapping[bytes, Optional[List[List[bytes]]]]]]: A mapping of stream keys, to a mapping of
stream IDs, to a list of pairings with format [[field, entry], [field, entry], ...]
.
Returns None if the BLOCK option is given and a timeout occurs, or if there is no stream that can be served.
Source code in glide/async_commands/transaction.py
2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 |
|
xrevrange(key, end, start, count=None)
Returns stream entries matching a given range of IDs in reverse order. Equivalent to XRANGE
but returns the
entries in reverse order.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
end
|
StreamRangeBound
|
The ending stream ID bound for the range.
|
required |
start
|
StreamRangeBound
|
The starting stream ID bound for the range.
|
required |
count
|
Optional[int]
|
An optional argument specifying the maximum count of stream entries to return.
If |
None
|
Command response
Optional[Mapping[bytes, List[List[bytes]]]]: A mapping of stream IDs to stream entry data, where entry data is a
list of pairings with format [[field, entry], [field, entry], ...]
.
Returns None if the range arguments are not applicable.
Source code in glide/async_commands/transaction.py
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 |
|
xtrim(key, options)
Trims the stream stored at key
by evicting older entries.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the stream. |
required |
options
|
StreamTrimOptions
|
Options detailing how to trim the stream. See |
required |
Commands response
int: TThe number of entries deleted from the stream.
If key
doesn't exist, 0 is returned.
Source code in glide/async_commands/transaction.py
2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 |
|
zadd(key, members_scores, existing_options=None, update_condition=None, changed=False)
Adds members with their scores to the sorted set stored at key
.
If a member is already a part of the sorted set, its score is updated.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
members_scores
|
Mapping[TEncodable, float]
|
A mapping of members to their corresponding scores. |
required |
existing_options
|
Optional[ConditionalChange]
|
Options for handling existing members.
|
None
|
update_condition
|
Optional[UpdateOptions]
|
Options for updating scores.
|
None
|
changed
|
bool
|
Modify the return value to return the number of changed elements, instead of the number of new elements added. |
False
|
Commands response
int: The number of elements added to the sorted set.
If changed
is set, returns the number of elements updated in the sorted set.
Source code in glide/async_commands/transaction.py
3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 |
|
zadd_incr(key, member, increment, existing_options=None, update_condition=None)
Increments the score of member in the sorted set stored at key
by increment
.
If member
does not exist in the sorted set, it is added with increment
as its score (as if its
previous score was 0.0).
If key
does not exist, a new sorted set with the specified member as its sole member is created.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
member
|
TEncodable
|
A member in the sorted set to increment. |
required |
increment
|
float
|
The score to increment the member. |
required |
existing_options
|
Optional[ConditionalChange]
|
Options for handling the member's existence.
|
None
|
update_condition
|
Optional[UpdateOptions]
|
Options for updating the score.
|
None
|
Commands response
Optional[float]: The score of the member.
If there was a conflict with choosing the XX/NX/LT/GT options, the operation aborts and None is returned.
Source code in glide/async_commands/transaction.py
3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 |
|
zcard(key)
Returns the cardinality (number of elements) of the sorted set stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
Commands response
int: The number of elements in the sorted set.
If key
does not exist, it is treated as an empty sorted set, and the command returns 0.
Source code in glide/async_commands/transaction.py
3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 |
|
zcount(key, min_score, max_score)
Returns the number of members in the sorted set stored at key
with scores between min_score
and max_score
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
min_score
|
Union[InfBound, ScoreBoundary]
|
The minimum score to count from. Can be an instance of InfBound representing positive/negative infinity, or ScoreBoundary representing a specific score and inclusivity. |
required |
max_score
|
Union[InfBound, ScoreBoundary]
|
The maximum score to count up to. Can be an instance of InfBound representing positive/negative infinity, or ScoreBoundary representing a specific score and inclusivity. |
required |
Commands response
int: The number of members in the specified score range.
If key does not exist, 0 is returned.
If max_score
< min_score
, 0 is returned.
Source code in glide/async_commands/transaction.py
3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 |
|
zdiff(keys)
Returns the difference between the first sorted set and all the successive sorted sets.
To get the elements with their scores, see zdiff_withscores
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
Command response
List[bytes]: A list of elements representing the difference between the sorted sets.
If the first key does not exist, it is treated as an empty sorted set, and the command returns an empty list.
Source code in glide/async_commands/transaction.py
3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 |
|
zdiff_withscores(keys)
Returns the difference between the first sorted set and all the successive sorted sets, with the associated scores.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
Command response
Mapping[bytes, float]: A mapping of elements and their scores representing the difference between the sorted sets.
If the first key
does not exist, it is treated as an empty sorted set, and the command returns an
empty list.
Source code in glide/async_commands/transaction.py
3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 |
|
zdiffstore(destination, keys)
Calculates the difference between the first sorted set and all the successive sorted sets at keys
and stores
the difference as a sorted set to destination
, overwriting it if it already exists. Non-existent keys are
treated as empty sets.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key for the resulting sorted set. |
required |
keys
|
List[TEncodable]
|
The keys of the sorted sets to compare. |
required |
Command response
int: The number of members in the resulting sorted set stored at destination
.
Source code in glide/async_commands/transaction.py
3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 |
|
zincrby(key, increment, member)
Increments the score of member
in the sorted set stored at key
by increment
.
If member
does not exist in the sorted set, it is added with increment
as its score.
If key
does not exist, a new sorted set is created with the specified member as its sole member.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
increment
|
float
|
The score increment. |
required |
member
|
TEncodable
|
A member of the sorted set. |
required |
Commands response
float: The new score of member
.
Source code in glide/async_commands/transaction.py
3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 |
|
zinter(keys)
Computes the intersection of sorted sets given by the specified keys
and returns a list of intersecting elements.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
Command response
List[bytes]: The resulting array of intersecting elements.
Source code in glide/async_commands/transaction.py
3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 |
|
zinter_withscores(keys, aggregation_type=None)
Computes the intersection of sorted sets given by the specified keys
and returns a sorted set of
intersecting elements with scores.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
Union[List[TEncodable], List[Tuple[TEncodable, float]]]
|
The keys of the sorted sets with possible formats:
|
required |
aggregation_type
|
Optional[AggregationType]
|
Specifies the aggregation strategy to apply
when combining the scores of elements. See |
None
|
Command response
Mapping[bytes, float]: The resulting sorted set with scores.
Source code in glide/async_commands/transaction.py
3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 |
|
zintercard(keys, limit=None)
Returns the cardinality of the intersection of the sorted sets specified by keys
. When provided with the
optional limit
argument, if the intersection cardinality reaches limit
partway through the computation, the
algorithm will exit early and yield limit
as the cardinality.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets to intersect. |
required |
limit
|
Optional[int]
|
An optional argument that can be used to specify a maximum number for the intersection cardinality. If limit is not supplied, or if it is set to 0, there will be no limit. |
None
|
Command response
int: The cardinality of the intersection of the given sorted sets, or the limit
if reached.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 |
|
zinterstore(destination, keys, aggregation_type=None)
Computes the intersection of sorted sets given by the specified keys
and stores the result in destination
.
If destination
already exists, it is overwritten. Otherwise, a new sorted set will be created.
Note
When in cluster mode, destination
and all keys in keys
must map to the same hash slot.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key of the destination sorted set. |
required |
keys
|
Union[List[TEncodable], Tuple[TEncodable, float]]]
|
The keys of the sorted sets with possible formats:
|
required |
aggregation_type
|
Optional[AggregationType]
|
Specifies the aggregation strategy to apply
when combining the scores of elements. See |
None
|
Command response
int: The number of elements in the resulting sorted set stored at destination
.
Source code in glide/async_commands/transaction.py
4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 |
|
zlexcount(key, min_lex, max_lex)
Returns the number of members in the sorted set stored at key
with lexographical values between
min_lex
and max_lex
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
min_lex
|
Union[InfBound, LexBoundary]
|
The minimum lexicographical value to count from. Can be an instance of InfBound representing positive/negative infinity, or LexBoundary representing a specific lexicographical value and inclusivity. |
required |
max_lex
|
Union[InfBound, LexBoundary]
|
The maximum lexicographical value to count up to. Can be an instance of InfBound representing positive/negative infinity, or LexBoundary representing a specific lexicographical value and inclusivity. |
required |
Command response
int: The number of members in the specified lexicographical range.
If key
does not exist, it is treated as an empty sorted set, and the command returns 0
.
If max_lex < min_lex
, 0
is returned.
Source code in glide/async_commands/transaction.py
3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 |
|
zmpop(keys, filter, count=None)
Pops a member-score pair from the first non-empty sorted set, with the given keys being checked in the order
that they are given. The optional count
argument can be used to specify the number of elements to pop, and is
set to 1 by default. The number of popped elements is the minimum from the sorted set's cardinality and count
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
modifier
|
ScoreFilter
|
The element pop criteria - either ScoreFilter.MIN or ScoreFilter.MAX to pop members with the lowest/highest scores accordingly. |
required |
count
|
Optional[int]
|
The number of elements to pop. |
None
|
Command response
Optional[List[Union[bytes, Mapping[bytes, float]]]]: A two-element list containing the key name of the set from which elements were popped, and a member-score mapping of the popped elements.
If no members could be popped, returns None.
Since: Valkey version 7.0.0.
Source code in glide/async_commands/transaction.py
4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 |
|
zmscore(key, members)
Returns the scores associated with the specified members
in the sorted set stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
members
|
List[TEncodable]
|
A list of members in the sorted set. |
required |
Command response
List[Optional[float]]: A list of scores corresponding to members
.
If a member does not exist in the sorted set, the corresponding value in the list will be None.
Source code in glide/async_commands/transaction.py
3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 |
|
zpopmax(key, count=None)
Removes and returns the members with the highest scores from the sorted set stored at key
.
If count
is provided, up to count
members with the highest scores are removed and returned.
Otherwise, only one member with the highest score is removed and returned.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
count
|
Optional[int]
|
Specifies the quantity of members to pop. If not specified, pops one member.
If |
None
|
Commands response
Mapping[bytes, float]: A map of the removed members and their scores, ordered from the one with the highest score to the one with the lowest.
If key
doesn't exist, it will be treated as an emtpy sorted set and the command returns an empty map.
Source code in glide/async_commands/transaction.py
3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 |
|
zpopmin(key, count=None)
Removes and returns the members with the lowest scores from the sorted set stored at key
.
If count
is provided, up to count
members with the lowest scores are removed and returned.
Otherwise, only one member with the lowest score is removed and returned.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
count
|
Optional[int]
|
Specifies the quantity of members to pop. If not specified, pops one member.
If |
None
|
Commands response
Mapping[bytes, float]: A map of the removed members and their scores, ordered from the one with the lowest score to the one with the highest.
If key
doesn't exist, it will be treated as an empty sorted set and the command returns an empty map.
Source code in glide/async_commands/transaction.py
3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 |
|
zrandmember(key)
Returns a random member from the sorted set stored at 'key'.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
Command response
Optional[bytes]: A random member from the sorted set.
If the sorted set does not exist or is empty, the response will be None.
Source code in glide/async_commands/transaction.py
4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 |
|
zrandmember_count(key, count)
Retrieves up to the absolute value of count
random members from the sorted set stored at 'key'.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
count
|
int
|
The number of members to return.
|
required |
Command response
List[bytes]: A list of members from the sorted set.
If the sorted set does not exist or is empty, the response will be an empty list.
Source code in glide/async_commands/transaction.py
4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 |
|
zrandmember_withscores(key, count)
Retrieves up to the absolute value of count
random members along with their scores from the sorted set
stored at 'key'.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
count
|
int
|
The number of members to return.
|
required |
Command response
List[List[Union[bytes, float]]]: A list of [member, score]
lists, where member
is a random member from
the sorted set and score
is the associated score.
If the sorted set does not exist or is empty, the response will be an empty list.
Source code in glide/async_commands/transaction.py
4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 |
|
zrange(key, range_query, reverse=False)
Returns the specified range of elements in the sorted set stored at key
.
ZRANGE can perform different types of range queries: by index (rank), by the score, or by lexicographical order.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
range_query
|
Union[RangeByIndex, RangeByLex, RangeByScore]
|
The range query object representing the type of range |
required |
reverse
|
bool
|
If True, reverses the sorted set, with index 0 as the element with the highest score. |
False
|
Commands response
List[bytes]: A list of elements within the specified range.
If key
does not exist, it is treated as an empty sorted set, and the command returns an empty array.
Source code in glide/async_commands/transaction.py
3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 |
|
zrange_withscores(key, range_query, reverse=False)
Returns the specified range of elements with their scores in the sorted set stored at key
.
Similar to ZRANGE but with a WITHSCORE flag.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
range_query
|
Union[RangeByIndex, RangeByScore]
|
The range query object representing the type of range query |
required |
reverse
|
bool
|
If True, reverses the sorted set, with index 0 as the element with the highest score. |
False
|
Commands response
Mapping[bytes , float]: A map of elements and their scores within the specified range.
If key
does not exist, it is treated as an empty sorted set, and the command returns an empty map.
Source code in glide/async_commands/transaction.py
3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 |
|
zrangestore(destination, source, range_query, reverse=False)
Stores a specified range of elements from the sorted set at source
, into a new sorted set at destination
. If
destination
doesn't exist, a new sorted set is created; if it exists, it's overwritten.
ZRANGESTORE can perform different types of range queries: by index (rank), by the score, or by lexicographical order.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key for the destination sorted set. |
required |
source
|
TEncodable
|
The key of the source sorted set. |
required |
range_query
|
Union[RangeByIndex, RangeByLex, RangeByScore]
|
The range query object representing the type of |
required |
reverse
|
bool
|
If True, reverses the sorted set, with index 0 as the element with the highest score. |
False
|
Command response
int: The number of elements in the resulting sorted set.
Source code in glide/async_commands/transaction.py
3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 |
|
zrank(key, member)
Returns the rank of member
in the sorted set stored at key
, with scores ordered from low to high.
See valkey.io for more details.
To get the rank of member
with its score, see zrank_withscore
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
member
|
TEncodable
|
The member whose rank is to be retrieved. |
required |
Commands response
Optional[int]: The rank of member
in the sorted set.
If key
doesn't exist, or if member
is not present in the set, None will be returned.
Source code in glide/async_commands/transaction.py
3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 |
|
zrank_withscore(key, member)
Returns the rank of member
in the sorted set stored at key
with its score, where scores are ordered from the
lowest to highest.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
member
|
TEncodable
|
The member whose rank is to be retrieved. |
required |
Commands response
Optional[List[Union[int, float]]]: A list containing the rank and score of member
in the sorted set.
If key
doesn't exist, or if member
is not present in the set, None will be returned.
Since: Valkey version 7.2.0.
Source code in glide/async_commands/transaction.py
3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 |
|
zrem(key, members)
Removes the specified members from the sorted set stored at key
.
Specified members that are not a member of this set are ignored.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
members
|
List[TEncodable]
|
A list of members to remove from the sorted set. |
required |
Commands response
int: The number of members that were removed from the sorted set, not including non-existing members.
If key
does not exist, it is treated as an empty sorted set, and the command returns 0.
Source code in glide/async_commands/transaction.py
3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 |
|
zremrangebylex(key, min_lex, max_lex)
Removes all elements in the sorted set stored at key
with a lexicographical order between min_lex
and
max_lex
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
min_lex
|
Union[InfBound, LexBoundary]
|
The minimum bound of the lexicographical range.
Can be an instance of |
required |
max_lex
|
Union[InfBound, LexBoundary]
|
The maximum bound of the lexicographical range.
Can be an instance of |
required |
Command response
int: The number of members that were removed from the sorted set.
If key
does not exist, it is treated as an empty sorted set, and the command returns 0
.
If min_lex
is greater than max_lex
, 0
is returned.
Source code in glide/async_commands/transaction.py
3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 |
|
zremrangebyrank(key, start, end)
Removes all elements in the sorted set stored at key
with rank between start
and end
.
Both start
and end
are zero-based indexes with 0 being the element with the lowest score.
These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
start
|
int
|
The starting point of the range. |
required |
end
|
int
|
The end of the range. |
required |
Command response
int: The number of elements that were removed.
If start
exceeds the end of the sorted set, or if start
is greater than end
, 0
is returned.
If end
exceeds the actual end of the sorted set, the range will stop at the actual end of the sorted set.
If key
does not exist, 0
is returned.
Source code in glide/async_commands/transaction.py
3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 |
|
zremrangebyscore(key, min_score, max_score)
Removes all elements in the sorted set stored at key
with a score between min_score
and max_score
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
min_score
|
Union[InfBound, ScoreBoundary]
|
The minimum score to remove from. Can be an instance of InfBound representing positive/negative infinity, or ScoreBoundary representing a specific score and inclusivity. |
required |
max_score
|
Union[InfBound, ScoreBoundary]
|
The maximum score to remove up to. Can be an instance of InfBound representing positive/negative infinity, or ScoreBoundary representing a specific score and inclusivity. |
required |
Commands response
int: The number of members that were removed from the sorted set.
If key
does not exist, it is treated as an empty sorted set, and the command returns 0.
If min_score
is greater than max_score
, 0 is returned.
Source code in glide/async_commands/transaction.py
3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 |
|
zrevrank(key, member)
Returns the rank of member
in the sorted set stored at key
, where scores are ordered from the highest to
lowest, starting from 0
.
To get the rank of member
with its score, see zrevrank_withscore
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
member
|
TEncodable
|
The member whose rank is to be retrieved. |
required |
Command response
Optional[int]: The rank of member
in the sorted set, where ranks are ordered from high to low based on scores.
If key
doesn't exist, or if member
is not present in the set, None
will be returned.
Source code in glide/async_commands/transaction.py
3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 |
|
zrevrank_withscore(key, member)
Returns the rank of member
in the sorted set stored at key
with its score, where scores are ordered from the
highest to lowest, starting from 0
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
member
|
TEncodable
|
The member whose rank is to be retrieved. |
required |
Command response
Optional[List[Union[int, float]]]: A list containing the rank (as int
) and score (as float
) of member
in the sorted set, where ranks are ordered from high to low based on scores.
If key
doesn't exist, or if member
is not present in the set, None
will be returned.
Since: Valkey version 7.2.0.
Source code in glide/async_commands/transaction.py
3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 |
|
zscan(key, cursor, match=None, count=None, no_scores=False)
Iterates incrementally over a sorted set.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
cursor
|
TEncodable
|
The cursor that points to the next iteration of results. A value of "0" indicates the start of the search. |
required |
match
|
Optional[TEncodable]
|
The match filter is applied to the result of the command and will only include
strings or byte strings that match the pattern specified. If the sorted set is large enough for scan commands
to return only a subset of the sorted set then there could be a case where the result is empty although there
are items that match the pattern specified. This is due to the default |
None
|
count
|
Optional[int]
|
|
None
|
no_scores
|
bool
|
If |
False
|
Returns:
Type | Description |
---|---|
TTransaction
|
List[Union[bytes, List[bytes]]]: An |
TTransaction
|
The first element is always the |
TTransaction
|
returned on the last iteration of the sorted set. The second element is always an |
TTransaction
|
of the sorted set held in |
TTransaction
|
|
TTransaction
|
If |
Source code in glide/async_commands/transaction.py
4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 |
|
zscore(key, member)
Returns the score of member
in the sorted set stored at key
.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
TEncodable
|
The key of the sorted set. |
required |
member
|
TEncodable
|
The member whose score is to be retrieved. |
required |
Commands response
Optional[float]: The score of the member.
If member
does not exist in the sorted set, None is returned.
If key
does not exist, None is returned.
Source code in glide/async_commands/transaction.py
3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 |
|
zunion(keys)
Computes the union of sorted sets given by the specified keys
and returns a list of union elements.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[TEncodable]
|
The keys of the sorted sets. |
required |
Command response
List[bytes]: The resulting array of union elements.
Source code in glide/async_commands/transaction.py
4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 |
|
zunion_withscores(keys, aggregation_type=None)
Computes the union of sorted sets given by the specified keys
and returns a sorted set of union elements with scores.
See valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
Union[List[TEncodable], List[Tuple[TEncodable, float]]]
|
The keys of the sorted sets with possible formats:
|
required |
aggregation_type
|
Optional[AggregationType]
|
Specifies the aggregation strategy to apply
when combining the scores of elements. See |
None
|
Command response
Mapping[bytes, float]: The resulting sorted set with scores.
Source code in glide/async_commands/transaction.py
4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 |
|
zunionstore(destination, keys, aggregation_type=None)
Computes the union of sorted sets given by the specified keys
and stores the result in destination
.
If destination
already exists, it is overwritten. Otherwise, a new sorted set will be created.
Note
When in cluster mode, destination
and all keys in keys
must map to the same hash slot.
see valkey.io for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
TEncodable
|
The key of the destination sorted set. |
required |
keys
|
Union[List[TEncodable], List[Tuple[TEncodable, float]]]
|
The keys of the sorted sets with possible formats:
|
required |
aggregation_type
|
Optional[AggregationType]
|
Specifies the aggregation strategy to apply
when combining the scores of elements. See |
None
|
Command response
int: The number of elements in the resulting sorted set stored at destination
.
Source code in glide/async_commands/transaction.py
4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 |
|