1 /* 2 * Hunt - A redis client library for D programming language. 3 * 4 * Copyright (C) 2018-2019 HuntLabs 5 * 6 * Website: https://www.huntlabs.net/ 7 * 8 * Licensed under the Apache-2.0 License. 9 * 10 */ 11 12 module hunt.redis.RedisCluster; 13 14 15 import hunt.redis.BinaryRedisCluster; 16 import hunt.redis.Redis; 17 import hunt.redis.RedisClusterCommand; 18 import hunt.redis.HostAndPort; 19 import hunt.redis.Protocol; 20 import hunt.redis.RedisClusterConnectionHandler; 21 import hunt.redis.params.GeoRadiusParam; 22 import hunt.redis.params.SetParams; 23 import hunt.redis.params.ZAddParams; 24 import hunt.redis.params.ZIncrByParams; 25 import hunt.redis.commands.RedisClusterCommands; 26 import hunt.redis.commands.RedisClusterScriptingCommands; 27 import hunt.redis.commands.MultiKeyRedisClusterCommands; 28 import hunt.redis.util.RedisClusterHashTagUtil; 29 import hunt.redis.util.KeyMergeUtil; 30 31 import hunt.collection.Collections; 32 import hunt.collection.List; 33 import hunt.collection.Map; 34 import hunt.collection.Set; 35 import hunt.pool.impl.GenericObjectPoolConfig; 36 37 import hunt.Long; 38 39 40 private template ClusterStringCommandTemplate(string name, R, string[] args) { 41 import std.format; 42 43 enum string statementBlock = q{ 44 scope RedisClusterCommand!(%2$s) command = 45 new class(connectionHandler, maxAttempts) RedisClusterCommand!(%2$s) { 46 47 this(RedisClusterConnectionHandler connectionHandler, int maxAttempts) { 48 super(connectionHandler, maxAttempts); 49 } 50 51 override %2$s execute(Redis connection) { 52 return connection.%1$s(%3$-(%s, %)); 53 } 54 }; 55 56 return command.run(%4$s); 57 }.format(name, R.stringof, args, args[0]); 58 59 // pragma(msg, statementBlock); 60 alias ClusterStringCommandTemplate = statementBlock; 61 } 62 63 /** 64 * 65 */ 66 class RedisCluster : BinaryRedisCluster, RedisClusterCommands, 67 MultiKeyRedisClusterCommands, RedisClusterScriptingCommands { 68 69 this(HostAndPort node) { 70 this(Collections.singleton(node)); 71 } 72 73 this(HostAndPort node, int timeout) { 74 this(Collections.singleton(node), timeout); 75 } 76 77 this(HostAndPort node, int timeout, int maxAttempts) { 78 this(Collections.singleton(node), timeout, maxAttempts); 79 } 80 81 this(HostAndPort node, GenericObjectPoolConfig poolConfig) { 82 this(Collections.singleton(node), poolConfig); 83 } 84 85 this(HostAndPort node, int timeout, GenericObjectPoolConfig poolConfig) { 86 this(Collections.singleton(node), timeout, poolConfig); 87 } 88 89 this(HostAndPort node, int timeout, int maxAttempts, 90 GenericObjectPoolConfig poolConfig) { 91 this(Collections.singleton(node), timeout, maxAttempts, poolConfig); 92 } 93 94 this(HostAndPort node, int connectionTimeout, int soTimeout, 95 int maxAttempts, GenericObjectPoolConfig poolConfig) { 96 this(Collections.singleton(node), connectionTimeout, soTimeout, maxAttempts, poolConfig); 97 } 98 99 this(HostAndPort node, int connectionTimeout, int soTimeout, 100 int maxAttempts, string password, GenericObjectPoolConfig poolConfig) { 101 this(Collections.singleton(node), connectionTimeout, soTimeout, maxAttempts, password, poolConfig); 102 } 103 104 this(HostAndPort node, int connectionTimeout, int soTimeout, 105 int maxAttempts, string password, string clientName, GenericObjectPoolConfig poolConfig) { 106 this(Collections.singleton(node), connectionTimeout, soTimeout, maxAttempts, password, clientName, poolConfig); 107 } 108 109 // this(HostAndPort node, int connectionTimeout, int soTimeout, 110 // int maxAttempts, string password, string clientName, GenericObjectPoolConfig poolConfig, 111 // bool ssl) { 112 // this(Collections.singleton(node), connectionTimeout, soTimeout, maxAttempts, password, clientName, poolConfig, ssl); 113 // } 114 115 // this(HostAndPort node, int connectionTimeout, int soTimeout, 116 // int maxAttempts, string password, string clientName, GenericObjectPoolConfig poolConfig, 117 // bool ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, 118 // HostnameVerifier hostnameVerifier, RedisClusterHostAndPortMap hostAndPortMap) { 119 // this(Collections.singleton(node), connectionTimeout, soTimeout, maxAttempts, password, clientName, poolConfig, 120 // ssl, sslSocketFactory, sslParameters, hostnameVerifier, hostAndPortMap); 121 // } 122 123 this(Set!(HostAndPort) nodes) { 124 this(nodes, DEFAULT_TIMEOUT); 125 } 126 127 this(Set!(HostAndPort) nodes, int timeout) { 128 this(nodes, timeout, DEFAULT_MAX_ATTEMPTS); 129 } 130 131 this(Set!(HostAndPort) nodes, int timeout, int maxAttempts) { 132 this(nodes, timeout, maxAttempts, new GenericObjectPoolConfig()); 133 } 134 135 this(Set!(HostAndPort) nodes, GenericObjectPoolConfig poolConfig) { 136 this(nodes, DEFAULT_TIMEOUT, DEFAULT_MAX_ATTEMPTS, poolConfig); 137 } 138 139 this(Set!(HostAndPort) nodes, int timeout, GenericObjectPoolConfig poolConfig) { 140 this(nodes, timeout, DEFAULT_MAX_ATTEMPTS, poolConfig); 141 } 142 143 this(Set!(HostAndPort) redisClusterNode, int timeout, int maxAttempts, 144 GenericObjectPoolConfig poolConfig) { 145 super(redisClusterNode, timeout, maxAttempts, poolConfig); 146 } 147 148 this(Set!(HostAndPort) redisClusterNode, int connectionTimeout, int soTimeout, 149 int maxAttempts, GenericObjectPoolConfig poolConfig) { 150 super(redisClusterNode, connectionTimeout, soTimeout, maxAttempts, poolConfig); 151 } 152 153 this(Set!(HostAndPort) redisClusterNode, int connectionTimeout, int soTimeout, 154 int maxAttempts, string password, GenericObjectPoolConfig poolConfig) { 155 super(redisClusterNode, connectionTimeout, soTimeout, maxAttempts, password, poolConfig); 156 } 157 158 this(Set!(HostAndPort) redisClusterNode, int connectionTimeout, int soTimeout, 159 int maxAttempts, string password, string clientName, GenericObjectPoolConfig poolConfig) { 160 super(redisClusterNode, connectionTimeout, soTimeout, maxAttempts, password, clientName, poolConfig); 161 } 162 163 // this(Set!(HostAndPort) redisClusterNode, int connectionTimeout, int soTimeout, 164 // int maxAttempts, string password, string clientName, GenericObjectPoolConfig poolConfig, 165 // bool ssl) { 166 // super(redisClusterNode, connectionTimeout, soTimeout, maxAttempts, password, clientName, poolConfig, ssl); 167 // } 168 169 // this(Set!(HostAndPort) redisClusterNode, int connectionTimeout, int soTimeout, 170 // int maxAttempts, string password, string clientName, GenericObjectPoolConfig poolConfig, 171 // bool ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, 172 // HostnameVerifier hostnameVerifier, RedisClusterHostAndPortMap hostAndPortMap) { 173 // super(redisClusterNode, connectionTimeout, soTimeout, maxAttempts, password, clientName, poolConfig, 174 // ssl, sslSocketFactory, sslParameters, hostnameVerifier, hostAndPortMap); 175 // } 176 177 override 178 string set(string key, string value) { 179 mixin(ClusterStringCommandTemplate!("set", string, [key.stringof, value.stringof])); 180 } 181 182 override 183 string set(string key, string value, SetParams params) { 184 mixin(ClusterStringCommandTemplate!("set", string, [key.stringof, value.stringof, params.stringof])); 185 } 186 187 override 188 string get(string key) { 189 mixin(ClusterStringCommandTemplate!("get", string, [key.stringof])); 190 } 191 192 override 193 bool exists(string key) { 194 mixin(ClusterStringCommandTemplate!("exists", bool, [key.stringof])); 195 } 196 197 override 198 Long exists(string[] keys...) { 199 mixin(ClusterStringCommandTemplate!("exists", Long, [keys.stringof])); 200 } 201 alias exists = BinaryRedisCluster.exists; 202 203 override 204 Long persist(string key) { 205 mixin(ClusterStringCommandTemplate!("persist", Long, [key.stringof])); 206 } 207 208 override 209 string type(string key) { 210 mixin(ClusterStringCommandTemplate!("type", string, [key.stringof])); 211 } 212 213 // override 214 // byte[] dump(string key) { 215 // return new RedisClusterCommand!(byte[])(connectionHandler, maxAttempts) { 216 // override 217 // byte[] execute(Redis connection) { 218 // return connection.dump(key); 219 // } 220 // }.run(key); 221 // } 222 223 // override 224 // string restore(string key, int ttl, byte[] serializedValue) { 225 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 226 // override 227 // string execute(Redis connection) { 228 // return connection.restore(key, ttl, serializedValue); 229 // } 230 // }.run(key); 231 // } 232 233 // override 234 // Long expire(string key, int seconds) { 235 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 236 // override 237 // Long execute(Redis connection) { 238 // return connection.expire(key, seconds); 239 // } 240 // }.run(key); 241 // } 242 243 // override 244 // Long pexpire(string key, long milliseconds) { 245 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 246 // override 247 // Long execute(Redis connection) { 248 // return connection.pexpire(key, milliseconds); 249 // } 250 // }.run(key); 251 // } 252 253 // override 254 // Long expireAt(string key, long unixTime) { 255 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 256 // override 257 // Long execute(Redis connection) { 258 // return connection.expireAt(key, unixTime); 259 // } 260 // }.run(key); 261 // } 262 263 // override 264 // Long pexpireAt(string key, long millisecondsTimestamp) { 265 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 266 // override 267 // Long execute(Redis connection) { 268 // return connection.pexpireAt(key, millisecondsTimestamp); 269 // } 270 // }.run(key); 271 // } 272 273 // override 274 // Long ttl(string key) { 275 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 276 // override 277 // Long execute(Redis connection) { 278 // return connection.ttl(key); 279 // } 280 // }.run(key); 281 // } 282 283 // override 284 // Long pttl(string key) { 285 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 286 // override 287 // Long execute(Redis connection) { 288 // return connection.pttl(key); 289 // } 290 // }.run(key); 291 // } 292 293 // override 294 // Long touch(string key) { 295 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 296 // override 297 // Long execute(Redis connection) { 298 // return connection.touch(key); 299 // } 300 // }.run(key); 301 // } 302 303 // override 304 // Long touch(string[] keys...) { 305 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 306 // override 307 // Long execute(Redis connection) { 308 // return connection.touch(keys); 309 // } 310 // }.run(keys.length, keys); 311 // } 312 313 // override 314 // Boolean setbit(string key, long offset, bool value) { 315 // return new RedisClusterCommand!(Boolean)(connectionHandler, maxAttempts) { 316 // override 317 // Boolean execute(Redis connection) { 318 // return connection.setbit(key, offset, value); 319 // } 320 // }.run(key); 321 // } 322 323 // override 324 // Boolean setbit(string key, long offset, string value) { 325 // return new RedisClusterCommand!(Boolean)(connectionHandler, maxAttempts) { 326 // override 327 // Boolean execute(Redis connection) { 328 // return connection.setbit(key, offset, value); 329 // } 330 // }.run(key); 331 // } 332 333 // override 334 // Boolean getbit(string key, long offset) { 335 // return new RedisClusterCommand!(Boolean)(connectionHandler, maxAttempts) { 336 // override 337 // Boolean execute(Redis connection) { 338 // return connection.getbit(key, offset); 339 // } 340 // }.run(key); 341 // } 342 343 // override 344 // Long setrange(string key, long offset, string value) { 345 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 346 // override 347 // Long execute(Redis connection) { 348 // return connection.setrange(key, offset, value); 349 // } 350 // }.run(key); 351 // } 352 353 // override 354 // string getrange(string key, long startOffset, long endOffset) { 355 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 356 // override 357 // string execute(Redis connection) { 358 // return connection.getrange(key, startOffset, endOffset); 359 // } 360 // }.run(key); 361 // } 362 363 // override 364 // string getSet(string key, string value) { 365 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 366 // override 367 // string execute(Redis connection) { 368 // return connection.getSet(key, value); 369 // } 370 // }.run(key); 371 // } 372 373 // override 374 // Long setnx(string key, string value) { 375 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 376 // override 377 // Long execute(Redis connection) { 378 // return connection.setnx(key, value); 379 // } 380 // }.run(key); 381 // } 382 383 // override 384 // string setex(string key, int seconds, string value) { 385 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 386 // override 387 // string execute(Redis connection) { 388 // return connection.setex(key, seconds, value); 389 // } 390 // }.run(key); 391 // } 392 393 // override 394 // string psetex(string key, long milliseconds, string value) { 395 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 396 // override 397 // string execute(Redis connection) { 398 // return connection.psetex(key, milliseconds, value); 399 // } 400 // }.run(key); 401 // } 402 403 // override 404 // Long decrBy(string key, long decrement) { 405 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 406 // override 407 // Long execute(Redis connection) { 408 // return connection.decrBy(key, decrement); 409 // } 410 // }.run(key); 411 // } 412 413 // override 414 // Long decr(string key) { 415 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 416 // override 417 // Long execute(Redis connection) { 418 // return connection.decr(key); 419 // } 420 // }.run(key); 421 // } 422 423 // override 424 // Long incrBy(string key, long increment) { 425 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 426 // override 427 // Long execute(Redis connection) { 428 // return connection.incrBy(key, increment); 429 // } 430 // }.run(key); 431 // } 432 433 // override 434 // Double incrByFloat(string key, double increment) { 435 // return new RedisClusterCommand!(Double)(connectionHandler, maxAttempts) { 436 // override 437 // Double execute(Redis connection) { 438 // return connection.incrByFloat(key, increment); 439 // } 440 // }.run(key); 441 // } 442 443 // override 444 // Long incr(string key) { 445 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 446 // override 447 // Long execute(Redis connection) { 448 // return connection.incr(key); 449 // } 450 // }.run(key); 451 // } 452 453 // override 454 // Long append(string key, string value) { 455 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 456 // override 457 // Long execute(Redis connection) { 458 // return connection.append(key, value); 459 // } 460 // }.run(key); 461 // } 462 463 // override 464 // string substr(string key, int start, int end) { 465 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 466 // override 467 // string execute(Redis connection) { 468 // return connection.substr(key, start, end); 469 // } 470 // }.run(key); 471 // } 472 473 // override 474 // Long hset(string key, string field, string value) { 475 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 476 // override 477 // Long execute(Redis connection) { 478 // return connection.hset(key, field, value); 479 // } 480 // }.run(key); 481 // } 482 483 // override 484 // Long hset(string key, Map!(string, string) hash) { 485 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 486 // override 487 // Long execute(Redis connection) { 488 // return connection.hset(key, hash); 489 // } 490 // }.run(key); 491 // } 492 493 // override 494 // string hget(string key, string field) { 495 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 496 // override 497 // string execute(Redis connection) { 498 // return connection.hget(key, field); 499 // } 500 // }.run(key); 501 // } 502 503 // override 504 // Long hsetnx(string key, string field, string value) { 505 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 506 // override 507 // Long execute(Redis connection) { 508 // return connection.hsetnx(key, field, value); 509 // } 510 // }.run(key); 511 // } 512 513 // override 514 // string hmset(string key, Map!(string, string) hash) { 515 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 516 // override 517 // string execute(Redis connection) { 518 // return connection.hmset(key, hash); 519 // } 520 // }.run(key); 521 // } 522 523 // override 524 // List!(string) hmget(string key, string[] fields...) { 525 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 526 // override 527 // List!(string) execute(Redis connection) { 528 // return connection.hmget(key, fields); 529 // } 530 // }.run(key); 531 // } 532 533 // override 534 // Long hincrBy(string key, string field, long value) { 535 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 536 // override 537 // Long execute(Redis connection) { 538 // return connection.hincrBy(key, field, value); 539 // } 540 // }.run(key); 541 // } 542 543 // override 544 // Boolean hexists(string key, string field) { 545 // return new RedisClusterCommand!(Boolean)(connectionHandler, maxAttempts) { 546 // override 547 // Boolean execute(Redis connection) { 548 // return connection.hexists(key, field); 549 // } 550 // }.run(key); 551 // } 552 553 // override 554 // Long hdel(string key, string[] field...) { 555 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 556 // override 557 // Long execute(Redis connection) { 558 // return connection.hdel(key, field); 559 // } 560 // }.run(key); 561 // } 562 563 // override 564 // Long hlen(string key) { 565 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 566 // override 567 // Long execute(Redis connection) { 568 // return connection.hlen(key); 569 // } 570 // }.run(key); 571 // } 572 573 // override 574 // Set!(string) hkeys(string key) { 575 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 576 // override 577 // Set!(string) execute(Redis connection) { 578 // return connection.hkeys(key); 579 // } 580 // }.run(key); 581 // } 582 583 // override 584 // List!(string) hvals(string key) { 585 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 586 // override 587 // List!(string) execute(Redis connection) { 588 // return connection.hvals(key); 589 // } 590 // }.run(key); 591 // } 592 593 // override 594 // Map!(string, string) hgetAll(string key) { 595 // return new RedisClusterCommand!(Map!(string, string))(connectionHandler, maxAttempts) { 596 // override 597 // Map!(string, string) execute(Redis connection) { 598 // return connection.hgetAll(key); 599 // } 600 // }.run(key); 601 // } 602 603 // override 604 // Long rpush(string key, string[] string...) { 605 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 606 // override 607 // Long execute(Redis connection) { 608 // return connection.rpush(key, string); 609 // } 610 // }.run(key); 611 // } 612 613 // override 614 // Long lpush(string key, string[] string...) { 615 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 616 // override 617 // Long execute(Redis connection) { 618 // return connection.lpush(key, string); 619 // } 620 // }.run(key); 621 // } 622 623 // override 624 // Long llen(string key) { 625 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 626 // override 627 // Long execute(Redis connection) { 628 // return connection.llen(key); 629 // } 630 // }.run(key); 631 // } 632 633 // override 634 // List!(string) lrange(string key, long start, long stop) { 635 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 636 // override 637 // List!(string) execute(Redis connection) { 638 // return connection.lrange(key, start, stop); 639 // } 640 // }.run(key); 641 // } 642 643 // override 644 // string ltrim(string key, long start, long stop) { 645 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 646 // override 647 // string execute(Redis connection) { 648 // return connection.ltrim(key, start, stop); 649 // } 650 // }.run(key); 651 // } 652 653 // override 654 // string lindex(string key, long index) { 655 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 656 // override 657 // string execute(Redis connection) { 658 // return connection.lindex(key, index); 659 // } 660 // }.run(key); 661 // } 662 663 // override 664 // string lset(string key, long index, string value) { 665 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 666 // override 667 // string execute(Redis connection) { 668 // return connection.lset(key, index, value); 669 // } 670 // }.run(key); 671 // } 672 673 // override 674 // Long lrem(string key, long count, string value) { 675 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 676 // override 677 // Long execute(Redis connection) { 678 // return connection.lrem(key, count, value); 679 // } 680 // }.run(key); 681 // } 682 683 // override 684 // string lpop(string key) { 685 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 686 // override 687 // string execute(Redis connection) { 688 // return connection.lpop(key); 689 // } 690 // }.run(key); 691 // } 692 693 // override 694 // string rpop(string key) { 695 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 696 // override 697 // string execute(Redis connection) { 698 // return connection.rpop(key); 699 // } 700 // }.run(key); 701 // } 702 703 // override 704 // Long sadd(string key, string[] member...) { 705 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 706 // override 707 // Long execute(Redis connection) { 708 // return connection.sadd(key, member); 709 // } 710 // }.run(key); 711 // } 712 713 // override 714 // Set!(string) smembers(string key) { 715 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 716 // override 717 // Set!(string) execute(Redis connection) { 718 // return connection.smembers(key); 719 // } 720 // }.run(key); 721 // } 722 723 // override 724 // Long srem(string key, string[] member...) { 725 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 726 // override 727 // Long execute(Redis connection) { 728 // return connection.srem(key, member); 729 // } 730 // }.run(key); 731 // } 732 733 // override 734 // string spop(string key) { 735 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 736 // override 737 // string execute(Redis connection) { 738 // return connection.spop(key); 739 // } 740 // }.run(key); 741 // } 742 743 // override 744 // Set!(string) spop(string key, long count) { 745 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 746 // override 747 // Set!(string) execute(Redis connection) { 748 // return connection.spop(key, count); 749 // } 750 // }.run(key); 751 // } 752 753 // override 754 // Long scard(string key) { 755 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 756 // override 757 // Long execute(Redis connection) { 758 // return connection.scard(key); 759 // } 760 // }.run(key); 761 // } 762 763 // override 764 // Boolean sismember(string key, string member) { 765 // return new RedisClusterCommand!(Boolean)(connectionHandler, maxAttempts) { 766 // override 767 // Boolean execute(Redis connection) { 768 // return connection.sismember(key, member); 769 // } 770 // }.run(key); 771 // } 772 773 // override 774 // string srandmember(string key) { 775 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 776 // override 777 // string execute(Redis connection) { 778 // return connection.srandmember(key); 779 // } 780 // }.run(key); 781 // } 782 783 // override 784 // List!(string) srandmember(string key, int count) { 785 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 786 // override 787 // List!(string) execute(Redis connection) { 788 // return connection.srandmember(key, count); 789 // } 790 // }.run(key); 791 // } 792 793 // override 794 // Long strlen(string key) { 795 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 796 // override 797 // Long execute(Redis connection) { 798 // return connection.strlen(key); 799 // } 800 // }.run(key); 801 // } 802 803 // override 804 // Long zadd(string key, double score, string member) { 805 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 806 // override 807 // Long execute(Redis connection) { 808 // return connection.zadd(key, score, member); 809 // } 810 // }.run(key); 811 // } 812 813 // override 814 // Long zadd(string key, double score, string member, 815 // ZAddParams params) { 816 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 817 // override 818 // Long execute(Redis connection) { 819 // return connection.zadd(key, score, member, params); 820 // } 821 // }.run(key); 822 // } 823 824 // override 825 // Long zadd(string key, Map!(string, double) scoreMembers) { 826 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 827 // override 828 // Long execute(Redis connection) { 829 // return connection.zadd(key, scoreMembers); 830 // } 831 // }.run(key); 832 // } 833 834 // override 835 // Long zadd(string key, Map!(string, double) scoreMembers, ZAddParams params) { 836 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 837 // override 838 // Long execute(Redis connection) { 839 // return connection.zadd(key, scoreMembers, params); 840 // } 841 // }.run(key); 842 // } 843 844 // override 845 // Set!(string) zrange(string key, long start, long stop) { 846 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 847 // override 848 // Set!(string) execute(Redis connection) { 849 // return connection.zrange(key, start, stop); 850 // } 851 // }.run(key); 852 // } 853 854 // override 855 // Long zrem(string key, string[] members...) { 856 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 857 // override 858 // Long execute(Redis connection) { 859 // return connection.zrem(key, members); 860 // } 861 // }.run(key); 862 // } 863 864 // override 865 // Double zincrby(string key, double increment, string member) { 866 // return new RedisClusterCommand!(Double)(connectionHandler, maxAttempts) { 867 // override 868 // Double execute(Redis connection) { 869 // return connection.zincrby(key, increment, member); 870 // } 871 // }.run(key); 872 // } 873 874 // override 875 // Double zincrby(string key, double increment, string member, 876 // ZIncrByParams params) { 877 // return new RedisClusterCommand!(Double)(connectionHandler, maxAttempts) { 878 // override 879 // Double execute(Redis connection) { 880 // return connection.zincrby(key, increment, member, params); 881 // } 882 // }.run(key); 883 // } 884 885 // override 886 // Long zrank(string key, string member) { 887 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 888 // override 889 // Long execute(Redis connection) { 890 // return connection.zrank(key, member); 891 // } 892 // }.run(key); 893 // } 894 895 // override 896 // Long zrevrank(string key, string member) { 897 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 898 // override 899 // Long execute(Redis connection) { 900 // return connection.zrevrank(key, member); 901 // } 902 // }.run(key); 903 // } 904 905 // override 906 // Set!(string) zrevrange(string key, long start, long stop) { 907 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 908 // override 909 // Set!(string) execute(Redis connection) { 910 // return connection.zrevrange(key, start, stop); 911 // } 912 // }.run(key); 913 // } 914 915 // override 916 // Set!(Tuple) zrangeWithScores(string key, long start, long stop) { 917 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 918 // override 919 // Set!(Tuple) execute(Redis connection) { 920 // return connection.zrangeWithScores(key, start, stop); 921 // } 922 // }.run(key); 923 // } 924 925 // override 926 // Set!(Tuple) zrevrangeWithScores(string key, long start, long stop) { 927 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 928 // override 929 // Set!(Tuple) execute(Redis connection) { 930 // return connection.zrevrangeWithScores(key, start, stop); 931 // } 932 // }.run(key); 933 // } 934 935 // override 936 // Long zcard(string key) { 937 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 938 // override 939 // Long execute(Redis connection) { 940 // return connection.zcard(key); 941 // } 942 // }.run(key); 943 // } 944 945 // override 946 // Double zscore(string key, string member) { 947 // return new RedisClusterCommand!(Double)(connectionHandler, maxAttempts) { 948 // override 949 // Double execute(Redis connection) { 950 // return connection.zscore(key, member); 951 // } 952 // }.run(key); 953 // } 954 955 // override 956 // List!(string) sort(string key) { 957 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 958 // override 959 // List!(string) execute(Redis connection) { 960 // return connection.sort(key); 961 // } 962 // }.run(key); 963 // } 964 965 // override 966 // List!(string) sort(string key, SortingParams sortingParameters) { 967 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 968 // override 969 // List!(string) execute(Redis connection) { 970 // return connection.sort(key, sortingParameters); 971 // } 972 // }.run(key); 973 // } 974 975 // override 976 // Long zcount(string key, double min, double max) { 977 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 978 // override 979 // Long execute(Redis connection) { 980 // return connection.zcount(key, min, max); 981 // } 982 // }.run(key); 983 // } 984 985 // override 986 // Long zcount(string key, string min, string max) { 987 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 988 // override 989 // Long execute(Redis connection) { 990 // return connection.zcount(key, min, max); 991 // } 992 // }.run(key); 993 // } 994 995 // override 996 // Set!(string) zrangeByScore(string key, double min, double max) { 997 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 998 // override 999 // Set!(string) execute(Redis connection) { 1000 // return connection.zrangeByScore(key, min, max); 1001 // } 1002 // }.run(key); 1003 // } 1004 1005 // override 1006 // Set!(string) zrangeByScore(string key, string min, string max) { 1007 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1008 // override 1009 // Set!(string) execute(Redis connection) { 1010 // return connection.zrangeByScore(key, min, max); 1011 // } 1012 // }.run(key); 1013 // } 1014 1015 // override 1016 // Set!(string) zrevrangeByScore(string key, double max, double min) { 1017 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1018 // override 1019 // Set!(string) execute(Redis connection) { 1020 // return connection.zrevrangeByScore(key, max, min); 1021 // } 1022 // }.run(key); 1023 // } 1024 1025 // override 1026 // Set!(string) zrangeByScore(string key, double min, double max, 1027 // int offset, int count) { 1028 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1029 // override 1030 // Set!(string) execute(Redis connection) { 1031 // return connection.zrangeByScore(key, min, max, offset, count); 1032 // } 1033 // }.run(key); 1034 // } 1035 1036 // override 1037 // Set!(string) zrevrangeByScore(string key, string max, string min) { 1038 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1039 // override 1040 // Set!(string) execute(Redis connection) { 1041 // return connection.zrevrangeByScore(key, max, min); 1042 // } 1043 // }.run(key); 1044 // } 1045 1046 // override 1047 // Set!(string) zrangeByScore(string key, string min, string max, 1048 // int offset, int count) { 1049 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1050 // override 1051 // Set!(string) execute(Redis connection) { 1052 // return connection.zrangeByScore(key, min, max, offset, count); 1053 // } 1054 // }.run(key); 1055 // } 1056 1057 // override 1058 // Set!(string) zrevrangeByScore(string key, double max, double min, 1059 // int offset, int count) { 1060 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1061 // override 1062 // Set!(string) execute(Redis connection) { 1063 // return connection.zrevrangeByScore(key, max, min, offset, count); 1064 // } 1065 // }.run(key); 1066 // } 1067 1068 // override 1069 // Set!(Tuple) zrangeByScoreWithScores(string key, double min, double max) { 1070 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1071 // override 1072 // Set!(Tuple) execute(Redis connection) { 1073 // return connection.zrangeByScoreWithScores(key, min, max); 1074 // } 1075 // }.run(key); 1076 // } 1077 1078 // override 1079 // Set!(Tuple) zrevrangeByScoreWithScores(string key, double max, double min) { 1080 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1081 // override 1082 // Set!(Tuple) execute(Redis connection) { 1083 // return connection.zrevrangeByScoreWithScores(key, max, min); 1084 // } 1085 // }.run(key); 1086 // } 1087 1088 // override 1089 // Set!(Tuple) zrangeByScoreWithScores(string key, double min, double max, 1090 // int offset, int count) { 1091 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1092 // override 1093 // Set!(Tuple) execute(Redis connection) { 1094 // return connection.zrangeByScoreWithScores(key, min, max, offset, count); 1095 // } 1096 // }.run(key); 1097 // } 1098 1099 // override 1100 // Set!(string) zrevrangeByScore(string key, string max, string min, 1101 // int offset, int count) { 1102 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1103 // override 1104 // Set!(string) execute(Redis connection) { 1105 // return connection.zrevrangeByScore(key, max, min, offset, count); 1106 // } 1107 // }.run(key); 1108 // } 1109 1110 // override 1111 // Set!(Tuple) zrangeByScoreWithScores(string key, string min, string max) { 1112 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1113 // override 1114 // Set!(Tuple) execute(Redis connection) { 1115 // return connection.zrangeByScoreWithScores(key, min, max); 1116 // } 1117 // }.run(key); 1118 // } 1119 1120 // override 1121 // Set!(Tuple) zrevrangeByScoreWithScores(string key, string max, string min) { 1122 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1123 // override 1124 // Set!(Tuple) execute(Redis connection) { 1125 // return connection.zrevrangeByScoreWithScores(key, max, min); 1126 // } 1127 // }.run(key); 1128 // } 1129 1130 // override 1131 // Set!(Tuple) zrangeByScoreWithScores(string key, string min, string max, 1132 // int offset, int count) { 1133 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1134 // override 1135 // Set!(Tuple) execute(Redis connection) { 1136 // return connection.zrangeByScoreWithScores(key, min, max, offset, count); 1137 // } 1138 // }.run(key); 1139 // } 1140 1141 // override 1142 // Set!(Tuple) zrevrangeByScoreWithScores(string key, double max, 1143 // double min, int offset, int count) { 1144 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1145 // override 1146 // Set!(Tuple) execute(Redis connection) { 1147 // return connection.zrevrangeByScoreWithScores(key, max, min, offset, count); 1148 // } 1149 // }.run(key); 1150 // } 1151 1152 // override 1153 // Set!(Tuple) zrevrangeByScoreWithScores(string key, string max, 1154 // string min, int offset, int count) { 1155 // return new RedisClusterCommand!(Set!(Tuple))(connectionHandler, maxAttempts) { 1156 // override 1157 // Set!(Tuple) execute(Redis connection) { 1158 // return connection.zrevrangeByScoreWithScores(key, max, min, offset, count); 1159 // } 1160 // }.run(key); 1161 // } 1162 1163 // override 1164 // Long zremrangeByRank(string key, long start, long stop) { 1165 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1166 // override 1167 // Long execute(Redis connection) { 1168 // return connection.zremrangeByRank(key, start, stop); 1169 // } 1170 // }.run(key); 1171 // } 1172 1173 // override 1174 // Long zremrangeByScore(string key, double min, double max) { 1175 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1176 // override 1177 // Long execute(Redis connection) { 1178 // return connection.zremrangeByScore(key, min, max); 1179 // } 1180 // }.run(key); 1181 // } 1182 1183 // override 1184 // Long zremrangeByScore(string key, string min, string max) { 1185 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1186 // override 1187 // Long execute(Redis connection) { 1188 // return connection.zremrangeByScore(key, min, max); 1189 // } 1190 // }.run(key); 1191 // } 1192 1193 // override 1194 // Long zlexcount(string key, string min, string max) { 1195 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1196 // override 1197 // Long execute(Redis connection) { 1198 // return connection.zlexcount(key, min, max); 1199 // } 1200 // }.run(key); 1201 // } 1202 1203 // override 1204 // Set!(string) zrangeByLex(string key, string min, string max) { 1205 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1206 // override 1207 // Set!(string) execute(Redis connection) { 1208 // return connection.zrangeByLex(key, min, max); 1209 // } 1210 // }.run(key); 1211 // } 1212 1213 // override 1214 // Set!(string) zrangeByLex(string key, string min, string max, 1215 // int offset, int count) { 1216 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1217 // override 1218 // Set!(string) execute(Redis connection) { 1219 // return connection.zrangeByLex(key, min, max, offset, count); 1220 // } 1221 // }.run(key); 1222 // } 1223 1224 // override 1225 // Set!(string) zrevrangeByLex(string key, string max, string min) { 1226 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1227 // override 1228 // Set!(string) execute(Redis connection) { 1229 // return connection.zrevrangeByLex(key, max, min); 1230 // } 1231 // }.run(key); 1232 // } 1233 1234 // override 1235 // Set!(string) zrevrangeByLex(string key, string max, string min, 1236 // int offset, int count) { 1237 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1238 // override 1239 // Set!(string) execute(Redis connection) { 1240 // return connection.zrevrangeByLex(key, max, min, offset, count); 1241 // } 1242 // }.run(key); 1243 // } 1244 1245 // override 1246 // Long zremrangeByLex(string key, string min, string max) { 1247 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1248 // override 1249 // Long execute(Redis connection) { 1250 // return connection.zremrangeByLex(key, min, max); 1251 // } 1252 // }.run(key); 1253 // } 1254 1255 // override 1256 // Long linsert(string key, ListPosition where, string pivot, 1257 // string value) { 1258 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1259 // override 1260 // Long execute(Redis connection) { 1261 // return connection.linsert(key, where, pivot, value); 1262 // } 1263 // }.run(key); 1264 // } 1265 1266 // override 1267 // Long lpushx(string key, string[] string...) { 1268 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1269 // override 1270 // Long execute(Redis connection) { 1271 // return connection.lpushx(key, string); 1272 // } 1273 // }.run(key); 1274 // } 1275 1276 // override 1277 // Long rpushx(string key, string[] string...) { 1278 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1279 // override 1280 // Long execute(Redis connection) { 1281 // return connection.rpushx(key, string); 1282 // } 1283 // }.run(key); 1284 // } 1285 1286 override 1287 Long del(string key) { 1288 mixin(ClusterStringCommandTemplate!("del", Long, [key.stringof])); 1289 } 1290 1291 override 1292 Long del(string[] keys...) { 1293 mixin(ClusterStringCommandTemplate!("del", Long, [keys.stringof])); 1294 } 1295 alias del = BinaryRedisCluster.del; 1296 1297 override 1298 Long unlink(string key) { 1299 mixin(ClusterStringCommandTemplate!("unlink", Long, [key.stringof])); 1300 } 1301 1302 override 1303 Long unlink(string[] keys...) { 1304 mixin(ClusterStringCommandTemplate!("unlink", Long, [keys.stringof])); 1305 } 1306 alias unlink = BinaryRedisCluster.unlink; 1307 1308 // override 1309 // string echo(string string) { 1310 // // note that it'll be run from arbitrary node 1311 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1312 // override 1313 // string execute(Redis connection) { 1314 // return connection.echo(string); 1315 // } 1316 // }.run(string); 1317 // } 1318 1319 // override 1320 // Long bitcount(string key) { 1321 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1322 // override 1323 // Long execute(Redis connection) { 1324 // return connection.bitcount(key); 1325 // } 1326 // }.run(key); 1327 // } 1328 1329 // override 1330 // Long bitcount(string key, long start, long end) { 1331 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1332 // override 1333 // Long execute(Redis connection) { 1334 // return connection.bitcount(key, start, end); 1335 // } 1336 // }.run(key); 1337 // } 1338 1339 // override 1340 // Set!(string) keys(string pattern) { 1341 // if (pattern is null || pattern.isEmpty()) { 1342 // throw new IllegalArgumentException(this.getClass().getSimpleName() 1343 // ~ " only supports KEYS commands with non-empty patterns"); 1344 // } 1345 // if (!RedisClusterHashTagUtil.isClusterCompliantMatchPattern(pattern)) { 1346 // throw new IllegalArgumentException(this.getClass().getSimpleName() 1347 // ~ " only supports KEYS commands with patterns containing hash-tags ( curly-brackets enclosed strings )"); 1348 // } 1349 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1350 // override 1351 // Set!(string) execute(Redis connection) { 1352 // return connection.keys(pattern); 1353 // } 1354 // }.run(pattern); 1355 // } 1356 1357 // override 1358 // ScanResult!(string) scan(string cursor, ScanParams params) { 1359 1360 // string matchPattern = null; 1361 1362 // if (params is null || (matchPattern = params.match()) is null || matchPattern.isEmpty()) { 1363 // throw new IllegalArgumentException(RedisCluster.class.getSimpleName() 1364 // ~ " only supports SCAN commands with non-empty MATCH patterns"); 1365 // } 1366 1367 // if (!RedisClusterHashTagUtil.isClusterCompliantMatchPattern(matchPattern)) { 1368 // throw new IllegalArgumentException(RedisCluster.class.getSimpleName() 1369 // ~ " only supports SCAN commands with MATCH patterns containing hash-tags ( curly-brackets enclosed strings )"); 1370 // } 1371 1372 // return new RedisClusterCommand!( ScanResult!(string))(connectionHandler, maxAttempts) { 1373 // override 1374 // ScanResult!(string) execute(Redis connection) { 1375 // return connection.scan(cursor, params); 1376 // } 1377 // }.run(matchPattern); 1378 // } 1379 1380 // override 1381 // ScanResult!(Entry!(string, string)) hscan(string key, string cursor) { 1382 // return new RedisClusterCommand!(ScanResult!(Entry!(string, string)))(connectionHandler, 1383 // maxAttempts) { 1384 // override 1385 // ScanResult!(Entry!(string, string)) execute(Redis connection) { 1386 // return connection.hscan(key, cursor); 1387 // } 1388 // }.run(key); 1389 // } 1390 1391 // override 1392 // ScanResult!(string) sscan(string key, string cursor) { 1393 // return new RedisClusterCommand!(ScanResult!(string))(connectionHandler, maxAttempts) { 1394 // override 1395 // ScanResult!(string) execute(Redis connection) { 1396 // return connection.sscan(key, cursor); 1397 // } 1398 // }.run(key); 1399 // } 1400 1401 // override 1402 // ScanResult!(Tuple) zscan(string key, string cursor) { 1403 // return new RedisClusterCommand!(ScanResult!(Tuple))(connectionHandler, maxAttempts) { 1404 // override 1405 // ScanResult!(Tuple) execute(Redis connection) { 1406 // return connection.zscan(key, cursor); 1407 // } 1408 // }.run(key); 1409 // } 1410 1411 // override 1412 // Long pfadd(string key, string[] elements...) { 1413 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1414 // override 1415 // Long execute(Redis connection) { 1416 // return connection.pfadd(key, elements); 1417 // } 1418 // }.run(key); 1419 // } 1420 1421 // override 1422 // long pfcount(string key) { 1423 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1424 // override 1425 // Long execute(Redis connection) { 1426 // return connection.pfcount(key); 1427 // } 1428 // }.run(key); 1429 // } 1430 1431 // override 1432 // List!(string) blpop(int timeout, string key) { 1433 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 1434 // override 1435 // List!(string) execute(Redis connection) { 1436 // return connection.blpop(timeout, key); 1437 // } 1438 // }.run(key); 1439 // } 1440 1441 // override 1442 // List!(string) brpop(int timeout, string key) { 1443 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 1444 // override 1445 // List!(string) execute(Redis connection) { 1446 // return connection.brpop(timeout, key); 1447 // } 1448 // }.run(key); 1449 // } 1450 1451 // override 1452 // List!(string) blpop(int timeout, string[] keys...) { 1453 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 1454 // override 1455 // List!(string) execute(Redis connection) { 1456 // return connection.blpop(timeout, keys); 1457 // } 1458 // }.run(keys.length, keys); 1459 1460 // } 1461 1462 // override 1463 // List!(string) brpop(int timeout, string[] keys...) { 1464 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 1465 // override 1466 // List!(string) execute(Redis connection) { 1467 // return connection.brpop(timeout, keys); 1468 // } 1469 // }.run(keys.length, keys); 1470 // } 1471 1472 override 1473 List!(string) mget(string[] keys...) { 1474 mixin(ClusterStringCommandTemplate!("mget", List!(string), [keys.stringof])); 1475 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 1476 // override 1477 // List!(string) execute(Redis connection) { 1478 // return connection.mget(keys); 1479 // } 1480 // }.run(keys.length, keys); 1481 } 1482 1483 override 1484 string mset(string[] keysvalues...) { 1485 string[] keys = new string[keysvalues.length / 2]; 1486 1487 for (int keyIdx = 0; keyIdx < keys.length; keyIdx++) { 1488 1489 keys[keyIdx] = keysvalues[keyIdx * 2]; 1490 } 1491 1492 mixin(ClusterStringCommandTemplate!("mset", string, [keys.stringof])); 1493 1494 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1495 // override 1496 // string execute(Redis connection) { 1497 // return connection.mset(keysvalues); 1498 // } 1499 // }.run(keys.length, keys); 1500 } 1501 1502 // override 1503 // Long msetnx(string[] keysvalues...) { 1504 // string[] keys = new string[keysvalues.length / 2]; 1505 1506 // for (int keyIdx = 0; keyIdx < keys.length; keyIdx++) { 1507 // keys[keyIdx] = keysvalues[keyIdx * 2]; 1508 // } 1509 1510 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1511 // override 1512 // Long execute(Redis connection) { 1513 // return connection.msetnx(keysvalues); 1514 // } 1515 // }.run(keys.length, keys); 1516 // } 1517 1518 // override 1519 // string rename(string oldkey, string newkey) { 1520 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1521 // override 1522 // string execute(Redis connection) { 1523 // return connection.rename(oldkey, newkey); 1524 // } 1525 // }.run(2, oldkey, newkey); 1526 // } 1527 1528 // override 1529 // Long renamenx(string oldkey, string newkey) { 1530 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1531 // override 1532 // Long execute(Redis connection) { 1533 // return connection.renamenx(oldkey, newkey); 1534 // } 1535 // }.run(2, oldkey, newkey); 1536 // } 1537 1538 // override 1539 // string rpoplpush(string srckey, string dstkey) { 1540 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1541 // override 1542 // string execute(Redis connection) { 1543 // return connection.rpoplpush(srckey, dstkey); 1544 // } 1545 // }.run(2, srckey, dstkey); 1546 // } 1547 1548 // override 1549 // Set!(string) sdiff(string[] keys...) { 1550 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1551 // override 1552 // Set!(string) execute(Redis connection) { 1553 // return connection.sdiff(keys); 1554 // } 1555 // }.run(keys.length, keys); 1556 // } 1557 1558 // override 1559 // Long sdiffstore(string dstkey, string[] keys...) { 1560 // string[] mergedKeys = KeyMergeUtil.merge(dstkey, keys); 1561 1562 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1563 // override 1564 // Long execute(Redis connection) { 1565 // return connection.sdiffstore(dstkey, keys); 1566 // } 1567 // }.run(mergedKeys.length, mergedKeys); 1568 // } 1569 1570 // override 1571 // Set!(string) sinter(string[] keys...) { 1572 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1573 // override 1574 // Set!(string) execute(Redis connection) { 1575 // return connection.sinter(keys); 1576 // } 1577 // }.run(keys.length, keys); 1578 // } 1579 1580 // override 1581 // Long sinterstore(string dstkey, string[] keys...) { 1582 // string[] mergedKeys = KeyMergeUtil.merge(dstkey, keys); 1583 1584 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1585 // override 1586 // Long execute(Redis connection) { 1587 // return connection.sinterstore(dstkey, keys); 1588 // } 1589 // }.run(mergedKeys.length, mergedKeys); 1590 // } 1591 1592 // override 1593 // Long smove(string srckey, string dstkey, string member) { 1594 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1595 // override 1596 // Long execute(Redis connection) { 1597 // return connection.smove(srckey, dstkey, member); 1598 // } 1599 // }.run(2, srckey, dstkey); 1600 // } 1601 1602 // override 1603 // Long sort(string key, SortingParams sortingParameters, string dstkey) { 1604 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1605 // override 1606 // Long execute(Redis connection) { 1607 // return connection.sort(key, sortingParameters, dstkey); 1608 // } 1609 // }.run(2, key, dstkey); 1610 // } 1611 1612 // override 1613 // Long sort(string key, string dstkey) { 1614 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1615 // override 1616 // Long execute(Redis connection) { 1617 // return connection.sort(key, dstkey); 1618 // } 1619 // }.run(2, key, dstkey); 1620 // } 1621 1622 // override 1623 // Set!(string) sunion(string[] keys...) { 1624 // return new RedisClusterCommand!(Set!(string))(connectionHandler, maxAttempts) { 1625 // override 1626 // Set!(string) execute(Redis connection) { 1627 // return connection.sunion(keys); 1628 // } 1629 // }.run(keys.length, keys); 1630 // } 1631 1632 // override 1633 // Long sunionstore(string dstkey, string[] keys...) { 1634 // string[] wholeKeys = KeyMergeUtil.merge(dstkey, keys); 1635 1636 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1637 // override 1638 // Long execute(Redis connection) { 1639 // return connection.sunionstore(dstkey, keys); 1640 // } 1641 // }.run(wholeKeys.length, wholeKeys); 1642 // } 1643 1644 // override 1645 // Long zinterstore(string dstkey, string[] sets...) { 1646 // string[] wholeKeys = KeyMergeUtil.merge(dstkey, sets); 1647 1648 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1649 // override 1650 // Long execute(Redis connection) { 1651 // return connection.zinterstore(dstkey, sets); 1652 // } 1653 // }.run(wholeKeys.length, wholeKeys); 1654 // } 1655 1656 // override 1657 // Long zinterstore(string dstkey, ZParams params, string[] sets...) { 1658 // string[] mergedKeys = KeyMergeUtil.merge(dstkey, sets); 1659 1660 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1661 // override 1662 // Long execute(Redis connection) { 1663 // return connection.zinterstore(dstkey, params, sets); 1664 // } 1665 // }.run(mergedKeys.length, mergedKeys); 1666 // } 1667 1668 // override 1669 // Long zunionstore(string dstkey, string[] sets...) { 1670 // string[] mergedKeys = KeyMergeUtil.merge(dstkey, sets); 1671 1672 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1673 // override 1674 // Long execute(Redis connection) { 1675 // return connection.zunionstore(dstkey, sets); 1676 // } 1677 // }.run(mergedKeys.length, mergedKeys); 1678 // } 1679 1680 // override 1681 // Long zunionstore(string dstkey, ZParams params, string[] sets...) { 1682 // string[] mergedKeys = KeyMergeUtil.merge(dstkey, sets); 1683 1684 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1685 // override 1686 // Long execute(Redis connection) { 1687 // return connection.zunionstore(dstkey, params, sets); 1688 // } 1689 // }.run(mergedKeys.length, mergedKeys); 1690 // } 1691 1692 // override 1693 // string brpoplpush(string source, string destination, int timeout) { 1694 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1695 // override 1696 // string execute(Redis connection) { 1697 // return connection.brpoplpush(source, destination, timeout); 1698 // } 1699 // }.run(2, source, destination); 1700 // } 1701 1702 // override 1703 // Long publish(string channel, string message) { 1704 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1705 // override 1706 // Long execute(Redis connection) { 1707 // return connection.publish(channel, message); 1708 // } 1709 // }.runWithAnyNode(); 1710 // } 1711 1712 // override 1713 // void subscribe(RedisPubSub redisPubSub, string[] channels...) { 1714 // new RedisClusterCommand!(Integer)(connectionHandler, maxAttempts) { 1715 // override 1716 // Integer execute(Redis connection) { 1717 // connection.subscribe(redisPubSub, channels); 1718 // return 0; 1719 // } 1720 // }.runWithAnyNode(); 1721 // } 1722 1723 // override 1724 // void psubscribe(RedisPubSub redisPubSub, string[] patterns...) { 1725 // new RedisClusterCommand!(Integer)(connectionHandler, maxAttempts) { 1726 // override 1727 // Integer execute(Redis connection) { 1728 // connection.psubscribe(redisPubSub, patterns); 1729 // return 0; 1730 // } 1731 // }.runWithAnyNode(); 1732 // } 1733 1734 // override 1735 // Long bitop(BitOP op, string destKey, string[] srcKeys...) { 1736 // string[] mergedKeys = KeyMergeUtil.merge(destKey, srcKeys); 1737 1738 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1739 // override 1740 // Long execute(Redis connection) { 1741 // return connection.bitop(op, destKey, srcKeys); 1742 // } 1743 // }.run(mergedKeys.length, mergedKeys); 1744 // } 1745 1746 // override 1747 // string pfmerge(string destkey, string[] sourcekeys...) { 1748 // string[] mergedKeys = KeyMergeUtil.merge(destkey, sourcekeys); 1749 1750 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1751 // override 1752 // string execute(Redis connection) { 1753 // return connection.pfmerge(destkey, sourcekeys); 1754 // } 1755 // }.run(mergedKeys.length, mergedKeys); 1756 // } 1757 1758 // override 1759 // long pfcount(string[] keys...) { 1760 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1761 // override 1762 // Long execute(Redis connection) { 1763 // return connection.pfcount(keys); 1764 // } 1765 // }.run(keys.length, keys); 1766 // } 1767 1768 // override 1769 // Object eval(string script, int keyCount, string[] params...) { 1770 // return new RedisClusterCommand!(Object)(connectionHandler, maxAttempts) { 1771 // override 1772 // Object execute(Redis connection) { 1773 // return connection.eval(script, keyCount, params); 1774 // } 1775 // }.run(keyCount, params); 1776 // } 1777 1778 // override 1779 // Object eval(string script, string sampleKey) { 1780 // return new RedisClusterCommand!(Object)(connectionHandler, maxAttempts) { 1781 // override 1782 // Object execute(Redis connection) { 1783 // return connection.eval(script); 1784 // } 1785 // }.run(sampleKey); 1786 // } 1787 1788 // override 1789 // Object eval(string script, List!(string) keys, List!(string) args) { 1790 // return new RedisClusterCommand!(Object)(connectionHandler, maxAttempts) { 1791 // override 1792 // Object execute(Redis connection) { 1793 // return connection.eval(script, keys, args); 1794 // } 1795 // }.run(keys.size(), keys.toArray(new string[keys.size()])); 1796 // } 1797 1798 // override 1799 // Object evalsha(string sha1, int keyCount, string[] params...) { 1800 // return new RedisClusterCommand!(Object)(connectionHandler, maxAttempts) { 1801 // override 1802 // Object execute(Redis connection) { 1803 // return connection.evalsha(sha1, keyCount, params); 1804 // } 1805 // }.run(keyCount, params); 1806 // } 1807 1808 // override 1809 // Object evalsha(string sha1, List!(string) keys, List!(string) args) { 1810 // return new RedisClusterCommand!(Object)(connectionHandler, maxAttempts) { 1811 // override 1812 // Object execute(Redis connection) { 1813 // return connection.evalsha(sha1, keys, args); 1814 // } 1815 // }.run(keys.size(), keys.toArray(new string[keys.size()])); 1816 // } 1817 1818 // override 1819 // Object evalsha(string sha1, string sampleKey) { 1820 // return new RedisClusterCommand!(Object)(connectionHandler, maxAttempts) { 1821 // override 1822 // Object execute(Redis connection) { 1823 // return connection.evalsha(sha1); 1824 // } 1825 // }.run(sampleKey); 1826 // } 1827 1828 // override 1829 // Boolean scriptExists(string sha1, string sampleKey) { 1830 // return new RedisClusterCommand!(Boolean)(connectionHandler, maxAttempts) { 1831 // override 1832 // Boolean execute(Redis connection) { 1833 // return connection.scriptExists(sha1); 1834 // } 1835 // }.run(sampleKey); 1836 // } 1837 1838 // override 1839 // List!(Boolean) scriptExists(string sampleKey, string[] sha1...) { 1840 // return new RedisClusterCommand!(List!(Boolean))(connectionHandler, maxAttempts) { 1841 // override 1842 // List!(Boolean) execute(Redis connection) { 1843 // return connection.scriptExists(sha1); 1844 // } 1845 // }.run(sampleKey); 1846 // } 1847 1848 // override 1849 // string scriptLoad(string script, string sampleKey) { 1850 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1851 // override 1852 // string execute(Redis connection) { 1853 // return connection.scriptLoad(script); 1854 // } 1855 // }.run(sampleKey); 1856 // } 1857 1858 // override 1859 // string scriptFlush(string sampleKey) { 1860 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1861 // override 1862 // string execute(Redis connection) { 1863 // return connection.scriptFlush(); 1864 // } 1865 // }.run(sampleKey); 1866 // } 1867 1868 // override 1869 // string scriptKill(string sampleKey) { 1870 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 1871 // override 1872 // string execute(Redis connection) { 1873 // return connection.scriptKill(); 1874 // } 1875 // }.run(sampleKey); 1876 // } 1877 1878 // override 1879 // Long geoadd(string key, double longitude, double latitude, 1880 // string member) { 1881 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1882 // override 1883 // Long execute(Redis connection) { 1884 // return connection.geoadd(key, longitude, latitude, member); 1885 // } 1886 // }.run(key); 1887 // } 1888 1889 // override 1890 // Long geoadd(string key, Map!(string, GeoCoordinate) memberCoordinateMap) { 1891 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 1892 // override 1893 // Long execute(Redis connection) { 1894 // return connection.geoadd(key, memberCoordinateMap); 1895 // } 1896 // }.run(key); 1897 // } 1898 1899 // override 1900 // Double geodist(string key, string member1, string member2) { 1901 // return new RedisClusterCommand!(Double)(connectionHandler, maxAttempts) { 1902 // override 1903 // Double execute(Redis connection) { 1904 // return connection.geodist(key, member1, member2); 1905 // } 1906 // }.run(key); 1907 // } 1908 1909 // override 1910 // Double geodist(string key, string member1, string member2, 1911 // GeoUnit unit) { 1912 // return new RedisClusterCommand!(Double)(connectionHandler, maxAttempts) { 1913 // override 1914 // Double execute(Redis connection) { 1915 // return connection.geodist(key, member1, member2, unit); 1916 // } 1917 // }.run(key); 1918 // } 1919 1920 // override 1921 // List!(string) geohash(string key, string[] members...) { 1922 // return new RedisClusterCommand!(List!(string))(connectionHandler, maxAttempts) { 1923 // override 1924 // List!(string) execute(Redis connection) { 1925 // return connection.geohash(key, members); 1926 // } 1927 // }.run(key); 1928 // } 1929 1930 // override 1931 // List!(GeoCoordinate) geopos(string key, string[] members...) { 1932 // return new RedisClusterCommand!(List!(GeoCoordinate))(connectionHandler, maxAttempts) { 1933 // override 1934 // List!(GeoCoordinate) execute(Redis connection) { 1935 // return connection.geopos(key, members); 1936 // } 1937 // }.run(key); 1938 // } 1939 1940 // override 1941 // List!(GeoRadiusResponse) georadius(string key, double longitude, 1942 // double latitude, double radius, GeoUnit unit) { 1943 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 1944 // override 1945 // List!(GeoRadiusResponse) execute(Redis connection) { 1946 // return connection.georadius(key, longitude, latitude, radius, unit); 1947 // } 1948 // }.run(key); 1949 // } 1950 1951 // override 1952 // List!(GeoRadiusResponse) georadiusReadonly(string key, double longitude, 1953 // double latitude, double radius, GeoUnit unit) { 1954 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 1955 // override 1956 // List!(GeoRadiusResponse) execute(Redis connection) { 1957 // return connection.georadiusReadonly(key, longitude, latitude, radius, unit); 1958 // } 1959 // }.run(key); 1960 // } 1961 1962 // override 1963 // List!(GeoRadiusResponse) georadius(string key, double longitude, 1964 // double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { 1965 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 1966 // override 1967 // List!(GeoRadiusResponse) execute(Redis connection) { 1968 // return connection.georadius(key, longitude, latitude, radius, unit, param); 1969 // } 1970 // }.run(key); 1971 // } 1972 1973 // override 1974 // List!(GeoRadiusResponse) georadiusReadonly(string key, double longitude, 1975 // double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { 1976 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 1977 // override 1978 // List!(GeoRadiusResponse) execute(Redis connection) { 1979 // return connection.georadiusReadonly(key, longitude, latitude, radius, unit, param); 1980 // } 1981 // }.run(key); 1982 // } 1983 1984 // override 1985 // List!(GeoRadiusResponse) georadiusByMember(string key, string member, 1986 // double radius, GeoUnit unit) { 1987 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 1988 // override 1989 // List!(GeoRadiusResponse) execute(Redis connection) { 1990 // return connection.georadiusByMember(key, member, radius, unit); 1991 // } 1992 // }.run(key); 1993 // } 1994 1995 // override 1996 // List!(GeoRadiusResponse) georadiusByMemberReadonly(string key, string member, 1997 // double radius, GeoUnit unit) { 1998 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 1999 // override 2000 // List!(GeoRadiusResponse) execute(Redis connection) { 2001 // return connection.georadiusByMemberReadonly(key, member, radius, unit); 2002 // } 2003 // }.run(key); 2004 // } 2005 2006 // override 2007 // List!(GeoRadiusResponse) georadiusByMember(string key, string member, 2008 // double radius, GeoUnit unit, GeoRadiusParam param) { 2009 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 2010 // override 2011 // List!(GeoRadiusResponse) execute(Redis connection) { 2012 // return connection.georadiusByMember(key, member, radius, unit, param); 2013 // } 2014 // }.run(key); 2015 // } 2016 2017 // override 2018 // List!(GeoRadiusResponse) georadiusByMemberReadonly(string key, string member, 2019 // double radius, GeoUnit unit, GeoRadiusParam param) { 2020 // return new RedisClusterCommand!(List!(GeoRadiusResponse))(connectionHandler, maxAttempts) { 2021 // override 2022 // List!(GeoRadiusResponse) execute(Redis connection) { 2023 // return connection.georadiusByMemberReadonly(key, member, radius, unit, param); 2024 // } 2025 // }.run(key); 2026 // } 2027 2028 // override 2029 // List!(Long) bitfield(string key, string[] arguments...) { 2030 // return new RedisClusterCommand!(List!(Long))(connectionHandler, maxAttempts) { 2031 // override 2032 // List!(Long) execute(Redis connection) { 2033 // return connection.bitfield(key, arguments); 2034 // } 2035 // }.run(key); 2036 // } 2037 2038 // override 2039 // Long hstrlen(string key, string field) { 2040 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 2041 // override 2042 // Long execute(Redis connection) { 2043 // return connection.hstrlen(key, field); 2044 // } 2045 // }.run(key); 2046 // } 2047 2048 // override 2049 // StreamEntryID xadd(string key, StreamEntryID id, Map!(string, string) hash) { 2050 // return new RedisClusterCommand!(StreamEntryID)(connectionHandler, maxAttempts) { 2051 // override 2052 // StreamEntryID execute(Redis connection) { 2053 // return connection.xadd(key, id, hash); 2054 // } 2055 // }.run(key); 2056 // } 2057 2058 // override 2059 // StreamEntryID xadd(string key, StreamEntryID id, Map!(string, string) hash, long maxLen, bool approximateLength) { 2060 // return new RedisClusterCommand!(StreamEntryID)(connectionHandler, maxAttempts) { 2061 // override 2062 // StreamEntryID execute(Redis connection) { 2063 // return connection.xadd(key, id, hash, maxLen, approximateLength); 2064 // } 2065 // }.run(key); 2066 // } 2067 2068 // override 2069 // Long xlen(string key) { 2070 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 2071 // override 2072 // Long execute(Redis connection) { 2073 // return connection.xlen(key); 2074 // } 2075 // }.run(key); 2076 // } 2077 2078 // override 2079 // List!(StreamEntry) xrange(string key, StreamEntryID start, StreamEntryID end, int count) { 2080 // return new RedisClusterCommand!(List!(StreamEntry))(connectionHandler, maxAttempts) { 2081 // override 2082 // List!(StreamEntry) execute(Redis connection) { 2083 // return connection.xrange(key, start, end, count); 2084 // } 2085 // }.run(key); 2086 // } 2087 2088 // override 2089 // List!(StreamEntry) xrevrange(string key, StreamEntryID end, StreamEntryID start, int count) { 2090 // return new RedisClusterCommand!(List!(StreamEntry))(connectionHandler, maxAttempts) { 2091 // override 2092 // List!(StreamEntry) execute(Redis connection) { 2093 // return connection.xrevrange(key, end, start, count); 2094 // } 2095 // }.run(key); 2096 // } 2097 2098 // override 2099 // List!(Entry!(string, List!(StreamEntry))) xread(int count, long block, Entry!(string, StreamEntryID) streams...) { 2100 // string[] keys = new string[streams.length]; 2101 // for(int i=0; i<streams.length; ++i) { 2102 // keys[i] = streams[i].getKey(); 2103 // } 2104 2105 // return new RedisClusterCommand!(List!(Entry!(string, List!(StreamEntry))))(connectionHandler, maxAttempts) { 2106 // override 2107 // List!(Entry!(string, List!(StreamEntry))) execute(Redis connection) { 2108 // return connection.xread(count, block, streams); 2109 // } 2110 // }.run(keys.length, keys); 2111 // } 2112 2113 // override 2114 // Long xack(string key, string group, StreamEntryID[] ids...) { 2115 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 2116 // override 2117 // Long execute(Redis connection) { 2118 // return connection.xack(key, group, ids); 2119 // } 2120 // }.run(key); 2121 // } 2122 2123 // override 2124 // string xgroupCreate(string key, string groupname, StreamEntryID id, bool makeStream) { 2125 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 2126 // override 2127 // string execute(Redis connection) { 2128 // return connection.xgroupCreate(key, groupname, id, makeStream); 2129 // } 2130 // }.run(key); 2131 // } 2132 2133 // override 2134 // string xgroupSetID(string key, string groupname, StreamEntryID id) { 2135 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 2136 // override 2137 // string execute(Redis connection) { 2138 // return connection.xgroupSetID(key, groupname, id); 2139 // } 2140 // }.run(key); 2141 // } 2142 2143 // override 2144 // Long xgroupDestroy(string key, string groupname) { 2145 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 2146 // override 2147 // Long execute(Redis connection) { 2148 // return connection.xgroupDestroy(key, groupname); 2149 // } 2150 // }.run(key); 2151 // } 2152 2153 // override 2154 // string xgroupDelConsumer(string key, string groupname, string consumername) { 2155 // return new RedisClusterCommand!(string)(connectionHandler, maxAttempts) { 2156 // override 2157 // string execute(Redis connection) { 2158 // return connection.xgroupDelConsumer(key, groupname, consumername); 2159 // } 2160 // }.run(key); 2161 // } 2162 2163 // override 2164 // List!(Entry!(string, List!(StreamEntry))) xreadGroup(string groupname, string consumer, int count, long block, 2165 // bool noAck, Entry!(string, StreamEntryID) streams...) { 2166 2167 // string[] keys = new string[streams.length]; 2168 // for(int i=0; i<streams.length; ++i) { 2169 // keys[i] = streams[i].getKey(); 2170 // } 2171 2172 // return new RedisClusterCommand!(List!(Entry!(string, List!(StreamEntry))))(connectionHandler, maxAttempts) { 2173 // override 2174 // List!(Entry!(string, List!(StreamEntry))) execute(Redis connection) { 2175 // return connection.xreadGroup(groupname, consumer, count, block, noAck, streams); 2176 // } 2177 // }.run(keys.length, keys); 2178 // } 2179 2180 // override 2181 // List!(StreamPendingEntry) xpending(string key, string groupname, StreamEntryID start, StreamEntryID end, int count, 2182 // string consumername) { 2183 // return new RedisClusterCommand!(List!(StreamPendingEntry))(connectionHandler, maxAttempts) { 2184 // override 2185 // List!(StreamPendingEntry) execute(Redis connection) { 2186 // return connection.xpending(key, groupname, start, end, count, consumername); 2187 // } 2188 // }.run(key); 2189 // } 2190 2191 // override 2192 // Long xdel(string key, StreamEntryID[] ids...) { 2193 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 2194 // override 2195 // Long execute(Redis connection) { 2196 // return connection.xdel(key, ids); 2197 // } 2198 // }.run(key); 2199 // } 2200 2201 // override 2202 // Long xtrim( string key, long maxLen, bool approximateLength) { 2203 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 2204 // override 2205 // Long execute(Redis connection) { 2206 // return connection.xtrim(key, maxLen, approximateLength); 2207 // } 2208 // }.run(key); 2209 // } 2210 2211 // override 2212 // List!(StreamEntry) xclaim(string key, string group, string consumername, long minIdleTime, long newIdleTime, 2213 // int retries, bool force, StreamEntryID[] ids...) { 2214 // return new RedisClusterCommand!(List!(StreamEntry))(connectionHandler, maxAttempts) { 2215 // override 2216 // List!(StreamEntry) execute(Redis connection) { 2217 // return connection.xclaim(key, group, consumername, minIdleTime, newIdleTime, retries, force, ids); 2218 // } 2219 // }.run(key); 2220 // } 2221 2222 // Long waitReplicas(string key, int replicas, long timeout) { 2223 // return new RedisClusterCommand!(Long)(connectionHandler, maxAttempts) { 2224 // override 2225 // Long execute(Redis connection) { 2226 // return connection.waitReplicas(replicas, timeout); 2227 // } 2228 // }.run(key); 2229 // } 2230 2231 // override 2232 // Object sendCommand(string sampleKey, ProtocolCommand cmd, string[] args...) { 2233 // return new RedisClusterCommand!(Object)(connectionHandler, maxAttempts) { 2234 // override 2235 // Object execute(Redis connection){ 2236 // return connection.sendCommand(cmd, args); 2237 // } 2238 // }.run(sampleKey); 2239 // } 2240 2241 2242 }