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.Client;
13 
14 import hunt.redis.BinaryClient;
15 import hunt.redis.BitOP;
16 import hunt.redis.BitPosParams;
17 import hunt.redis.ClusterReset;
18 import hunt.redis.GeoCoordinate;
19 import hunt.redis.GeoUnit;
20 import hunt.redis.ListPosition;
21 import hunt.redis.Protocol;
22 import hunt.redis.ScanParams;
23 import hunt.redis.SortingParams;
24 import hunt.redis.StreamEntryID;
25 import hunt.redis.ZParams;
26 
27 import hunt.redis.commands.Commands;
28 import hunt.redis.params.ClientKillParams;
29 import hunt.redis.params.GeoRadiusParam;
30 import hunt.redis.params.MigrateParams;
31 import hunt.redis.params.SetParams;
32 import hunt.redis.params.ZAddParams;
33 import hunt.redis.params.ZIncrByParams;
34 import hunt.redis.util.SafeEncoder;
35 
36 
37 // import hunt.Double;
38 import hunt.collection.ArrayList;
39 import hunt.collection.HashMap;
40 import hunt.collection.List;
41 import hunt.collection.Map;
42 
43 import std.conv;
44 
45 class Client : BinaryClient, Commands {
46 
47     this() {
48         super();
49     }
50 
51     this(string host) {
52         super(host);
53     }
54 
55     this(string host, int port) {
56         super(host, port);
57     }
58 
59     this(string host, int port, bool ssl) {
60         super(host, port, ssl);
61     }
62 
63     // this(string host, int port, bool ssl,
64     //     SSLSocketFactory sslSocketFactory, SSLParameters sslParameters,
65     //     HostnameVerifier hostnameVerifier) {
66     //   super(host, port, ssl, sslSocketFactory, sslParameters, hostnameVerifier);
67     // }
68 
69     override
70     void ping(string message) {
71         ping(SafeEncoder.encode(message));
72     }
73     alias ping = BinaryClient.ping;
74     
75     override
76     void set(string key, string value) {
77         set(SafeEncoder.encode(key), SafeEncoder.encode(value));
78     }
79     alias set = BinaryClient.set;
80 
81     override
82     void set(string key, string value, SetParams params) {
83         set(SafeEncoder.encode(key), SafeEncoder.encode(value), params);
84     }
85 
86     override
87     void get(string key) {
88         get(SafeEncoder.encode(key));
89     }
90     alias get = BinaryClient.get;
91 
92     override
93     void exists(string[] keys...) {
94         exists(SafeEncoder.encodeMany(keys));
95     }
96     alias exists = BinaryClient.exists;
97 
98     override
99     void del(string[] keys...) {
100         del(SafeEncoder.encodeMany(keys));
101     }
102     alias del = BinaryClient.del;
103 
104     override
105     void unlink(string[] keys...) {
106         unlink(SafeEncoder.encodeMany(keys));
107     }
108     alias unlink = BinaryClient.unlink;
109 
110     override
111     void type(string key) {
112         type(SafeEncoder.encode(key));
113     }
114     alias type = BinaryClient.type;
115 
116     override
117     void keys(string pattern) {
118         keys(SafeEncoder.encode(pattern));
119     }
120     alias keys = BinaryClient.keys;
121 
122     override
123     void rename(string oldkey, string newkey) {
124         rename(SafeEncoder.encode(oldkey), SafeEncoder.encode(newkey));
125     }
126     alias rename = BinaryClient.rename;
127 
128     void renamenx(string oldkey, string newkey) {
129         renamenx(SafeEncoder.encode(oldkey), SafeEncoder.encode(newkey));
130     }
131     alias renamenx = BinaryClient.renamenx;
132 
133     void expire(string key, int seconds) {
134         expire(SafeEncoder.encode(key), seconds);
135     }
136     alias expire = BinaryClient.expire;
137 
138     // override
139     void expireAt(string key, long unixTime) {
140         expireAt(SafeEncoder.encode(key), unixTime);
141     }
142     alias expireAt = BinaryClient.expireAt;
143 
144 
145     void ttl(string key) {
146         ttl(SafeEncoder.encode(key));
147     }
148     alias ttl = BinaryClient.ttl;
149 
150     override
151     void touch(string[] keys...) {
152         touch(SafeEncoder.encodeMany(keys));
153     }
154     alias touch = BinaryClient.touch;
155 
156     override
157     void move(string key, int dbIndex) {
158         move(SafeEncoder.encode(key), dbIndex);
159     }
160     alias move = BinaryClient.move;
161 
162     override
163     void getSet(string key, string value) {
164         getSet(SafeEncoder.encode(key), SafeEncoder.encode(value));
165     }
166     alias getSet = BinaryClient.getSet;
167 
168     override
169     void mget(string[] keys...) {
170         mget(SafeEncoder.encodeMany(keys));
171     }
172     alias mget = BinaryClient.mget;
173 
174     override
175     void setnx(string key, string value) {
176         setnx(SafeEncoder.encode(key), SafeEncoder.encode(value));
177     }
178     alias setnx = BinaryClient.setnx;
179 
180     override
181     void setex(string key, int seconds, string value) {
182         setex(SafeEncoder.encode(key), seconds, SafeEncoder.encode(value));
183     }
184     alias setex = BinaryClient.setex;
185 
186     override
187     void mset(string[] keysvalues...) {
188         mset(SafeEncoder.encodeMany(keysvalues));
189     }
190     alias mset = BinaryClient.mset;
191 
192     override
193     void msetnx(string[] keysvalues...) {
194         msetnx(SafeEncoder.encodeMany(keysvalues));
195     }
196     alias msetnx = BinaryClient.msetnx;
197 
198     override
199     void decrBy(string key, long decrement) {
200         decrBy(SafeEncoder.encode(key), decrement);
201     }
202     alias decrBy = BinaryClient.decrBy;
203 
204     override
205     void decr(string key) {
206         decr(SafeEncoder.encode(key));
207     }
208     alias decr = BinaryClient.decr;
209 
210     override
211     void incrBy(string key, long increment) {
212         incrBy(SafeEncoder.encode(key), increment);
213     }
214     alias incrBy = BinaryClient.incrBy;
215 
216     override
217     void incr(string key) {
218         incr(SafeEncoder.encode(key));
219     }
220     alias incr = BinaryClient.incr;
221 
222     override
223     void append(string key, string value) {
224         append(SafeEncoder.encode(key), SafeEncoder.encode(value));
225     }
226     alias append = BinaryClient.append;
227 
228     override
229     void substr(string key, int start, int end) {
230         substr(SafeEncoder.encode(key), start, end);
231     }
232     alias substr = BinaryClient.substr;
233 
234     override
235     void hset(string key, string field, string value) {
236         hset(SafeEncoder.encode(key), SafeEncoder.encode(field), SafeEncoder.encode(value));
237     }
238     alias hset = BinaryClient.hset;
239 
240     override
241     void hset(string key, Map!(string, string) hash) {
242         Map!(const(ubyte)[], const(ubyte)[]) bhash = new HashMap!(const(ubyte)[], const(ubyte)[])(hash.size());
243         foreach(string k, string v; hash) {
244             bhash.put(SafeEncoder.encode(k), SafeEncoder.encode(v));
245         }
246         hset(SafeEncoder.encode(key), bhash);
247     }
248 
249     override
250     void hget(string key, string field) {
251         hget(SafeEncoder.encode(key), SafeEncoder.encode(field));
252     }
253     alias hget = BinaryClient.hget;
254 
255     override
256     void hsetnx(string key, string field, string value) {
257         hsetnx(SafeEncoder.encode(key), SafeEncoder.encode(field), SafeEncoder.encode(value));
258     }
259     alias hsetnx = BinaryClient.hsetnx;
260 
261     override
262     void hmset(string key, Map!(string, string) hash) {
263         Map!(const(ubyte)[], const(ubyte)[]) bhash = new HashMap!(const(ubyte)[], const(ubyte)[])(hash.size());
264         foreach(string k, string v; hash) {
265             bhash.put(SafeEncoder.encode(k), SafeEncoder.encode(v));
266         }
267         hmset(SafeEncoder.encode(key), bhash);
268     }
269     alias hmset = BinaryClient.hmset;
270 
271     override
272     void hmget(string key, string[] fields...) {
273         hmget(SafeEncoder.encode(key), SafeEncoder.encodeMany(fields));
274     }
275     alias hmget = BinaryClient.hmget;
276 
277     override
278     void hincrBy(string key, string field, long value) {
279         hincrBy(SafeEncoder.encode(key), SafeEncoder.encode(field), value);
280     }
281     alias hincrBy = BinaryClient.hincrBy;
282 
283     override
284     void hexists(string key, string field) {
285         hexists(SafeEncoder.encode(key), SafeEncoder.encode(field));
286     }
287     alias hexists = BinaryClient.hexists;
288 
289     override
290     void hdel(string key, string[] fields...) {
291         hdel(SafeEncoder.encode(key), SafeEncoder.encodeMany(fields));
292     }
293     alias hdel = BinaryClient.hdel;
294 
295     override
296     void hlen(string key) {
297         hlen(SafeEncoder.encode(key));
298     }
299     alias hlen = BinaryClient.hlen;
300 
301     override
302     void hkeys(string key) {
303         hkeys(SafeEncoder.encode(key));
304     }
305     alias hkeys = BinaryClient.hkeys;
306 
307     override
308     void hvals(string key) {
309         hvals(SafeEncoder.encode(key));
310     }
311     alias hvals = BinaryClient.hvals;
312 
313     override
314     void hgetAll(string key) {
315         hgetAll(SafeEncoder.encode(key));
316     }
317     alias hgetAll = BinaryClient.hgetAll;
318 
319     override
320     void rpush(string key, string[] string...) {
321         rpush(SafeEncoder.encode(key), SafeEncoder.encodeMany(string));
322     }
323     alias rpush = BinaryClient.rpush;
324 
325     override
326     void lpush(string key, string[] string...) {
327         lpush(SafeEncoder.encode(key), SafeEncoder.encodeMany(string));
328     }
329     alias lpush = BinaryClient.lpush;
330 
331     override
332     void llen(string key) {
333         llen(SafeEncoder.encode(key));
334     }
335     alias llen = BinaryClient.llen;
336 
337     override
338     void lrange(string key, long start, long stop) {
339         lrange(SafeEncoder.encode(key), start, stop);
340     }
341     alias lrange = BinaryClient.lrange;
342 
343     override
344     void ltrim(string key, long start, long stop) {
345         ltrim(SafeEncoder.encode(key), start, stop);
346     }
347     alias ltrim = BinaryClient.ltrim;
348 
349     override
350     void lindex(string key, long index) {
351         lindex(SafeEncoder.encode(key), index);
352     }
353     alias lindex = BinaryClient.lindex;
354 
355     override
356     void lset(string key, long index, string value) {
357         lset(SafeEncoder.encode(key), index, SafeEncoder.encode(value));
358     }
359     alias lset = BinaryClient.lset;
360 
361     override
362     void lrem(string key, long count, string value) {
363         lrem(SafeEncoder.encode(key), count, SafeEncoder.encode(value));
364     }
365     alias lrem = BinaryClient.lrem;
366 
367     override
368     void lpop(string key) {
369         lpop(SafeEncoder.encode(key));
370     }
371     alias lpop = BinaryClient.lpop;
372 
373     override
374     void rpop(string key) {
375         rpop(SafeEncoder.encode(key));
376     }
377     alias rpop = BinaryClient.rpop;
378 
379     override
380     void rpoplpush(string srckey, string dstkey) {
381         rpoplpush(SafeEncoder.encode(srckey), SafeEncoder.encode(dstkey));
382     }
383     alias rpoplpush = BinaryClient.rpoplpush;
384 
385     override
386     void sadd(string key, string[] members...) {
387         sadd(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
388     }
389     alias sadd = BinaryClient.sadd;
390 
391     override
392     void smembers(string key) {
393         smembers(SafeEncoder.encode(key));
394     }
395     alias smembers = BinaryClient.smembers;
396 
397     override
398     void srem(string key, string[] members...) {
399         srem(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
400     }
401     alias srem = BinaryClient.srem;
402 
403     override
404     void spop(string key) {
405         spop(SafeEncoder.encode(key));
406     }
407     alias spop = BinaryClient.spop;
408 
409     override
410     void spop(string key, long count) {
411         spop(SafeEncoder.encode(key), count);
412     }
413     alias spop = BinaryClient.spop;
414 
415     override
416     void smove(string srckey, string dstkey, string member) {
417         smove(SafeEncoder.encode(srckey), SafeEncoder.encode(dstkey), SafeEncoder.encode(member));
418     }
419     alias smove = BinaryClient.smove;
420 
421     override
422     void scard(string key) {
423         scard(SafeEncoder.encode(key));
424     }
425     alias scard = BinaryClient.scard;
426 
427     override
428     void sismember(string key, string member) {
429         sismember(SafeEncoder.encode(key), SafeEncoder.encode(member));
430     }
431     alias sismember = BinaryClient.sismember;
432 
433     override
434     void sinter(string[] keys...) {
435         sinter(SafeEncoder.encodeMany(keys));
436     }
437     alias sinter = BinaryClient.sinter;
438 
439     override
440     void sinterstore(string dstkey, string[] keys...) {
441         sinterstore(SafeEncoder.encode(dstkey), SafeEncoder.encodeMany(keys));
442     }
443     alias sinterstore = BinaryClient.sinterstore;
444 
445     override
446     void sunion(string[] keys...) {
447         sunion(SafeEncoder.encodeMany(keys));
448     }
449     alias sunion = BinaryClient.sunion;
450 
451     override
452     void sunionstore(string dstkey, string[] keys...) {
453         sunionstore(SafeEncoder.encode(dstkey), SafeEncoder.encodeMany(keys));
454     }
455     alias sunionstore = BinaryClient.sunionstore;
456 
457     override
458     void sdiff(string[] keys...) {
459         sdiff(SafeEncoder.encodeMany(keys));
460     }
461     alias sdiff = BinaryClient.sdiff;
462 
463     override
464     void sdiffstore(string dstkey, string[] keys...) {
465         sdiffstore(SafeEncoder.encode(dstkey), SafeEncoder.encodeMany(keys));
466     }
467     alias sdiffstore = BinaryClient.sdiffstore;
468 
469     override
470     void srandmember(string key) {
471         srandmember(SafeEncoder.encode(key));
472     }
473     alias srandmember = BinaryClient.srandmember;
474 
475     override
476     void zadd(string key, double score, string member) {
477         zadd(SafeEncoder.encode(key), score, SafeEncoder.encode(member));
478     }
479     alias zadd = BinaryClient.zadd;
480 
481     override
482     void zadd(string key, double score, string member,
483             ZAddParams params) {
484         zadd(SafeEncoder.encode(key), score, SafeEncoder.encode(member), params);
485     }
486     alias zadd = BinaryClient.zadd;
487 
488     override
489     void zadd(string key, Map!(string, double) scoreMembers) {
490         HashMap!(const(ubyte)[], double) binaryScoreMembers = convertScoreMembersToBinary(scoreMembers);
491         zadd(SafeEncoder.encode(key), binaryScoreMembers);
492     }
493     alias zadd = BinaryClient.zadd;
494 
495     override
496     void zadd(string key, Map!(string, double) scoreMembers, ZAddParams params) {
497         HashMap!(const(ubyte)[], double) binaryScoreMembers = convertScoreMembersToBinary(scoreMembers);
498         zadd(SafeEncoder.encode(key), binaryScoreMembers, params);
499     }
500     alias zadd = BinaryClient.zadd;
501 
502     override
503     void zrange(string key, long start, long stop) {
504         zrange(SafeEncoder.encode(key), start, stop);
505     }
506     alias zrange = BinaryClient.zrange;
507 
508     override
509     void zrem(string key, string[] members...) {
510         zrem(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
511     }
512     alias zrem = BinaryClient.zrem;
513 
514     override
515     void zincrby(string key, double increment, string member) {
516         zincrby(SafeEncoder.encode(key), increment, SafeEncoder.encode(member));
517     }
518     alias zincrby = BinaryClient.zincrby;
519 
520     override
521     void zincrby(string key, double increment, string member, ZIncrByParams params) {
522         zincrby(SafeEncoder.encode(key), increment, SafeEncoder.encode(member), params);
523     }
524 
525     override
526     void zrank(string key, string member) {
527         zrank(SafeEncoder.encode(key), SafeEncoder.encode(member));
528     }
529     alias zrank = BinaryClient.zrank;
530 
531     override
532     void zrevrank(string key, string member) {
533         zrevrank(SafeEncoder.encode(key), SafeEncoder.encode(member));
534     }
535     alias zrevrank = BinaryClient.zrevrank;
536 
537     override
538     void zrevrange(string key, long start, long stop) {
539         zrevrange(SafeEncoder.encode(key), start, stop);
540     }
541     alias zrevrange = BinaryClient.zrevrange;
542 
543     override
544     void zrangeWithScores(string key, long start, long stop) {
545         zrangeWithScores(SafeEncoder.encode(key), start, stop);
546     }
547     alias zrangeWithScores = BinaryClient.zrangeWithScores;
548 
549     override
550     void zrevrangeWithScores(string key, long start, long stop) {
551         zrevrangeWithScores(SafeEncoder.encode(key), start, stop);
552     }
553     alias zrevrangeWithScores = BinaryClient.zrevrangeWithScores;
554 
555     override
556     void zcard(string key) {
557         zcard(SafeEncoder.encode(key));
558     }
559     alias zcard = BinaryClient.zcard;
560 
561     override
562     void zscore(string key, string member) {
563         zscore(SafeEncoder.encode(key), SafeEncoder.encode(member));
564     }
565     alias zscore = BinaryClient.zscore;
566 
567     override
568     void watch(string[] keys...) {
569         watch(SafeEncoder.encodeMany(keys));
570     }
571     alias watch = BinaryClient.watch;
572 
573     override
574     void sort(string key) {
575         sort(SafeEncoder.encode(key));
576     }
577     alias sort = BinaryClient.sort;
578 
579     override
580     void sort(string key, SortingParams sortingParameters) {
581         sort(SafeEncoder.encode(key), sortingParameters);
582     }
583 
584     override
585     void blpop(string[] args) {
586         blpop(SafeEncoder.encodeMany(args));
587     }
588     alias blpop = BinaryClient.blpop;
589 
590     void blpop(int timeout, string[] keys...) {
591         size_t size = keys.length + 1;
592         List!(string) args = new ArrayList!(string)(cast(int)size);
593         foreach(string arg ; keys) {
594             args.add(arg);
595         }
596         args.add(to!string(timeout));
597         blpop(args.toArray());
598     }
599 
600     override
601     void sort(string key, SortingParams sortingParameters, string dstkey) {
602         sort(SafeEncoder.encode(key), sortingParameters, SafeEncoder.encode(dstkey));
603     }
604     alias sort = BinaryClient.sort;
605 
606     override
607     void sort(string key, string dstkey) {
608         sort(SafeEncoder.encode(key), SafeEncoder.encode(dstkey));
609     }
610 
611     override
612     void brpop(string[] args) {
613         brpop(SafeEncoder.encodeMany(args));
614     }
615     alias brpop = BinaryClient.brpop;
616 
617     void brpop(int timeout, string[] keys...) {
618         size_t size = keys.length + 1;
619         List!(string) args = new ArrayList!(string)(cast(int)size);
620         foreach(string arg ; keys) {
621             args.add(arg);
622         }
623         args.add(to!string(timeout));
624         brpop(args.toArray());
625     }
626 
627     override
628     void zcount(string key, double min, double max) {
629         zcount(SafeEncoder.encode(key), toByteArray(min), toByteArray(max));
630     }
631     alias zcount = BinaryClient.zcount;
632 
633     override
634     void zcount(string key, string min, string max) {
635         zcount(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
636     }
637 
638     override
639     void zrangeByScore(string key, double min, double max) {
640         zrangeByScore(SafeEncoder.encode(key), toByteArray(min), toByteArray(max));
641     }
642     alias zrangeByScore = BinaryClient.zrangeByScore;
643 
644     override
645     void zrangeByScore(string key, string min, string max) {
646         zrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
647     }
648 
649     override
650     void zrangeByScore(string key, double min, double max, int offset,
651             int count) {
652         zrangeByScore(SafeEncoder.encode(key), toByteArray(min), toByteArray(max), offset, count);
653     }
654 
655     override
656     void zrangeByScoreWithScores(string key, double min, double max) {
657         zrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(min), toByteArray(max));
658     }
659     alias zrangeByScoreWithScores = BinaryClient.zrangeByScoreWithScores;
660 
661     override
662     void zrangeByScoreWithScores(string key, double min, double max,
663             int offset, int count) {
664         zrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(min), toByteArray(max), offset,
665             count);
666     }
667 
668     override
669     void zrevrangeByScore(string key, double max, double min) {
670         zrevrangeByScore(SafeEncoder.encode(key), toByteArray(max), toByteArray(min));
671     }
672     alias zrevrangeByScore = BinaryClient.zrevrangeByScore;
673 
674     override
675     void zrangeByScore(string key, string min, string max, int offset,
676             int count) {
677         zrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max),
678             offset, count);
679     }
680 
681     override
682     void zrangeByScoreWithScores(string key, string min, string max) {
683         zrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(min),
684             SafeEncoder.encode(max));
685     }
686     alias zrangeByScoreWithScores = BinaryClient.zrangeByScoreWithScores;
687 
688     override
689     void zrangeByScoreWithScores(string key, string min, string max,
690             int offset, int count) {
691         zrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(min),
692             SafeEncoder.encode(max), offset, count);
693     }
694 
695     override
696     void zrevrangeByScore(string key, string max, string min) {
697         zrevrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(max), SafeEncoder.encode(min));
698     }
699     alias zrevrangeByScore = BinaryClient.zrevrangeByScore;
700 
701     override
702     void zrevrangeByScore(string key, double max, double min,
703             int offset, int count) {
704         zrevrangeByScore(SafeEncoder.encode(key), toByteArray(max), toByteArray(min), offset, count);
705     }
706 
707     override
708     void zrevrangeByScore(string key, string max, string min,
709             int offset, int count) {
710         zrevrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(max), SafeEncoder.encode(min),
711             offset, count);
712     }
713 
714 
715     override
716     void zrevrangeByScoreWithScores(string key, double max, double min) {
717         zrevrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(max), toByteArray(min));
718     }
719     alias zrevrangeByScoreWithScores = BinaryClient.zrevrangeByScoreWithScores;
720 
721     override
722     void zrevrangeByScoreWithScores(string key, string max, string min) {
723         zrevrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(max),
724             SafeEncoder.encode(min));
725     }
726 
727     override
728     void zrevrangeByScoreWithScores(string key, double max, double min,
729             int offset, int count) {
730         zrevrangeByScoreWithScores(SafeEncoder.encode(key), toByteArray(max), toByteArray(min), offset,
731             count);
732     }
733 
734     override
735     void zrevrangeByScoreWithScores(string key, string max, string min,
736             int offset, int count) {
737         zrevrangeByScoreWithScores(SafeEncoder.encode(key), SafeEncoder.encode(max),
738             SafeEncoder.encode(min), offset, count);
739     }
740 
741     override
742     void zremrangeByRank(string key, long start, long stop) {
743         zremrangeByRank(SafeEncoder.encode(key), start, stop);
744     }
745     alias zremrangeByRank = BinaryClient.zremrangeByRank;
746 
747     override
748     void zremrangeByScore(string key, double min, double max) {
749         zremrangeByScore(SafeEncoder.encode(key), toByteArray(min), toByteArray(max));
750     }
751     alias zremrangeByScore = BinaryClient.zremrangeByScore;
752 
753     override
754     void zremrangeByScore(string key, string min, string max) {
755         zremrangeByScore(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
756     }
757 
758     override
759     void zunionstore(string dstkey, string[] sets...) {
760         zunionstore(SafeEncoder.encode(dstkey), SafeEncoder.encodeMany(sets));
761     }
762     alias zunionstore = BinaryClient.zunionstore;
763 
764     override
765     void zunionstore(string dstkey, ZParams params, string[] sets...) {
766         zunionstore(SafeEncoder.encode(dstkey), params, SafeEncoder.encodeMany(sets));
767     }
768 
769     override
770     void zinterstore(string dstkey, string[] sets...) {
771         zinterstore(SafeEncoder.encode(dstkey), SafeEncoder.encodeMany(sets));
772     }
773     alias zinterstore = BinaryClient.zinterstore;
774 
775     override
776     void zinterstore(string dstkey, ZParams params, string[] sets...) {
777         zinterstore(SafeEncoder.encode(dstkey), params, SafeEncoder.encodeMany(sets));
778     }
779 
780     void zlexcount(string key, string min, string max) {
781         zlexcount(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
782     }
783     alias zlexcount = BinaryClient.zlexcount;
784 
785     void zrangeByLex(string key, string min, string max) {
786         zrangeByLex(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
787     }
788     alias zrangeByLex = BinaryClient.zrangeByLex;
789 
790     void zrangeByLex(string key, string min, string max, int offset,
791             int count) {
792         zrangeByLex(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max), offset,
793             count);
794     }
795 
796     void zrevrangeByLex(string key, string max, string min) {
797         zrevrangeByLex(SafeEncoder.encode(key), SafeEncoder.encode(max), SafeEncoder.encode(min));
798     }
799     alias zrevrangeByLex = BinaryClient.zrevrangeByLex;
800 
801     void zrevrangeByLex(string key, string max, string min, int offset, int count) {
802         zrevrangeByLex(SafeEncoder.encode(key), SafeEncoder.encode(max), SafeEncoder.encode(min),
803             offset, count);
804     }
805 
806     void zremrangeByLex(string key, string min, string max) {
807         zremrangeByLex(SafeEncoder.encode(key), SafeEncoder.encode(min), SafeEncoder.encode(max));
808     }
809     alias zremrangeByLex = BinaryClient.zremrangeByLex;
810 
811     override
812     void strlen(string key) {
813         strlen(SafeEncoder.encode(key));
814     }
815     alias strlen = BinaryClient.strlen;
816 
817     override
818     void lpushx(string key, string[] string...) {
819         lpushx(SafeEncoder.encode(key), SafeEncoder.encodeMany(string));
820     }
821     alias lpushx = BinaryClient.lpushx;
822 
823     override
824     void persist(string key) {
825         persist(SafeEncoder.encode(key));
826     }
827     alias persist = BinaryClient.persist;
828 
829     override
830     void rpushx(string key, string[] string...) {
831         rpushx(SafeEncoder.encode(key), SafeEncoder.encodeMany(string));
832     }
833     alias rpushx = BinaryClient.rpushx;
834 
835     override
836     void echo(string string) {
837         echo(SafeEncoder.encode(string));
838     }
839     alias echo = BinaryClient.echo;
840 
841     override
842     void linsert(string key, ListPosition where, string pivot,
843             string value) {
844         linsert(SafeEncoder.encode(key), where, SafeEncoder.encode(pivot), SafeEncoder.encode(value));
845     }
846     alias linsert = BinaryClient.linsert;
847 
848     override
849     void brpoplpush(string source, string destination, int timeout) {
850         brpoplpush(SafeEncoder.encode(source), SafeEncoder.encode(destination), timeout);
851     }
852     alias brpoplpush = BinaryClient.brpoplpush;
853 
854     override
855     void setbit(string key, long offset, bool value) {
856         setbit(SafeEncoder.encode(key), offset, value);
857     }
858     alias setbit = BinaryClient.setbit;
859 
860     override
861     void setbit(string key, long offset, string value) {
862         setbit(SafeEncoder.encode(key), offset, SafeEncoder.encode(value));
863     }
864     alias setbit = BinaryClient.setbit;
865 
866     override
867     void getbit(string key, long offset) {
868         getbit(SafeEncoder.encode(key), offset);
869     }
870     alias getbit = BinaryClient.getbit;
871 
872     void bitpos(string key, bool value, BitPosParams params) {
873         bitpos(SafeEncoder.encode(key), value, params);
874     }
875     alias bitpos = BinaryClient.bitpos;
876 
877     override
878     void setrange(string key, long offset, string value) {
879         setrange(SafeEncoder.encode(key), offset, SafeEncoder.encode(value));
880     }
881     alias setrange = BinaryClient.setrange;
882 
883     override
884     void getrange(string key, long startOffset, long endOffset) {
885         getrange(SafeEncoder.encode(key), startOffset, endOffset);
886     }
887     alias getrange = BinaryClient.getrange;
888 
889     void publish(string channel, string message) {
890         publish(SafeEncoder.encode(channel), SafeEncoder.encode(message));
891     }
892     alias publish = BinaryClient.publish;
893 
894     void unsubscribe(string[] channels...) {
895         unsubscribe(SafeEncoder.encodeMany(channels));
896     }
897     alias unsubscribe = BinaryClient.unsubscribe;
898 
899     void psubscribe(string[] patterns...) {
900         psubscribe(SafeEncoder.encodeMany(patterns));
901     }
902     alias psubscribe = BinaryClient.psubscribe;
903 
904     void punsubscribe(string[] patterns...) {
905         punsubscribe(SafeEncoder.encodeMany(patterns));
906     }
907     alias punsubscribe = BinaryClient.punsubscribe;
908 
909     void subscribe(string[] channels...) {
910         subscribe(SafeEncoder.encodeMany(channels));
911     }
912     alias subscribe = BinaryClient.subscribe;
913 
914     void pubsubChannels(string pattern) {
915         pubsub(Protocol.PUBSUB_CHANNELS, pattern);
916     }
917 
918     void pubsubNumPat() {
919         pubsub(Protocol.PUBSUB_NUM_PAT);
920     }
921 
922     void pubsubNumSub(string[] channels...) {
923         pubsub(Protocol.PUBSUB_NUMSUB, channels);
924     }
925 
926     // override
927     void configSet(string parameter, string value) {
928         configSet(SafeEncoder.encode(parameter), SafeEncoder.encode(value));
929     }
930     alias configSet = BinaryClient.configSet;
931 
932     // override
933     void configGet(string pattern) {
934         configGet(SafeEncoder.encode(pattern));
935     }
936     alias configGet = BinaryClient.configGet;
937 
938     void eval(string script, int keyCount, string[] params...) {
939         eval(SafeEncoder.encode(script), toByteArray(keyCount), SafeEncoder.encodeMany(params));
940     }
941     alias eval = BinaryClient.eval;
942 
943     void evalsha(string sha1, int keyCount, string[] params...) {
944         evalsha(SafeEncoder.encode(sha1), toByteArray(keyCount), SafeEncoder.encodeMany(params));
945     }
946     alias evalsha = BinaryClient.evalsha;
947 
948     void scriptExists(string[] sha1...) {
949         scriptExists(SafeEncoder.encodeMany(sha1));
950     }
951     alias scriptExists = BinaryClient.scriptExists;
952 
953     void scriptLoad(string script) {
954         scriptLoad(SafeEncoder.encode(script));
955     }
956     alias scriptLoad = BinaryClient.scriptLoad;
957 
958     override
959     void objectRefcount(string key) {
960         objectRefcount(SafeEncoder.encode(key));
961     }
962     alias objectRefcount = BinaryClient.objectRefcount;
963 
964     override
965     void objectIdletime(string key) {
966         objectIdletime(SafeEncoder.encode(key));
967     }
968     alias objectIdletime = BinaryClient.objectIdletime;
969 
970     override
971     void objectEncoding(string key) {
972         objectEncoding(SafeEncoder.encode(key));
973     }
974     alias objectEncoding = BinaryClient.objectEncoding;
975 
976     override
977     void bitcount(string key) {
978         bitcount(SafeEncoder.encode(key));
979     }
980     alias bitcount = BinaryClient.bitcount;
981 
982     override
983     void bitcount(string key, long start, long end) {
984         bitcount(SafeEncoder.encode(key), start, end);
985     }
986     alias bitcount = BinaryClient.bitcount;
987 
988     override
989     void bitop(BitOP op, string destKey, string[] srcKeys...) {
990         bitop(op, SafeEncoder.encode(destKey), SafeEncoder.encodeMany(srcKeys));
991     }
992     alias bitop = BinaryClient.bitop;
993 
994     void sentinel(string[] args...) {
995         sentinel(SafeEncoder.encodeMany(args));
996     }
997     alias sentinel = BinaryClient.sentinel;
998 
999     override
1000     void dump(string key) {
1001         dump(SafeEncoder.encode(key));
1002     }
1003     alias dump = BinaryClient.dump;
1004 
1005     // override
1006     void restore(string key, int ttl, const(ubyte)[] serializedValue) {
1007         restore(SafeEncoder.encode(key), ttl, serializedValue);
1008     }
1009     alias restore = BinaryClient.restore;
1010 
1011     // override
1012     void restoreReplace(string key, int ttl, const(ubyte)[] serializedValue) {
1013         restoreReplace(SafeEncoder.encode(key), ttl, serializedValue);
1014     }
1015     alias restoreReplace = BinaryClient.restoreReplace;
1016 
1017     void pexpire(string key, long milliseconds) {
1018         pexpire(SafeEncoder.encode(key), milliseconds);
1019     }
1020     alias pexpire = BinaryClient.pexpire;
1021 
1022     void pexpireAt(string key, long millisecondsTimestamp) {
1023         pexpireAt(SafeEncoder.encode(key), millisecondsTimestamp);
1024     }
1025     alias pexpireAt = BinaryClient.pexpireAt;
1026 
1027     override
1028     void pttl(string key) {
1029         pttl(SafeEncoder.encode(key));
1030     }
1031     alias pttl = BinaryClient.pttl;
1032 
1033     override
1034     void incrByFloat(string key, double increment) {
1035         incrByFloat(SafeEncoder.encode(key), increment);
1036     }
1037     alias incrByFloat = BinaryClient.incrByFloat;
1038 
1039     void psetex(string key, long milliseconds, string value) {
1040         psetex(SafeEncoder.encode(key), milliseconds, SafeEncoder.encode(value));
1041     }
1042     alias psetex = BinaryClient.psetex;
1043 
1044     void srandmember(string key, int count) {
1045         srandmember(SafeEncoder.encode(key), count);
1046     }
1047     alias srandmember = BinaryClient.srandmember;
1048 
1049     void clientKill(string ipPort) {
1050         clientKill(SafeEncoder.encode(ipPort));
1051     }
1052     alias clientKill = BinaryClient.clientKill;
1053 
1054     void clientSetname(string name) {
1055         clientSetname(SafeEncoder.encode(name));
1056     }
1057     alias clientSetname = BinaryClient.clientSetname;
1058 
1059     override
1060     void migrate(string host, int port, string key,
1061             int destinationDb, int timeout) {
1062         migrate(host, port, SafeEncoder.encode(key), destinationDb, timeout);
1063     }
1064     alias migrate = BinaryClient.migrate;
1065 
1066     override
1067     void migrate(string host, int port, int destinationDB,
1068             int timeout, MigrateParams params, string[] keys...) {
1069         migrate(host, port, destinationDB, timeout, params, SafeEncoder.encodeMany(keys));
1070     }
1071 
1072     override
1073     void hincrByFloat(string key, string field, double increment) {
1074         hincrByFloat(SafeEncoder.encode(key), SafeEncoder.encode(field), increment);
1075     }
1076     alias hincrByFloat = BinaryClient.hincrByFloat;
1077 
1078     override
1079     void scan(string cursor, ScanParams params) {
1080         scan(SafeEncoder.encode(cursor), params);
1081     }
1082     alias scan = BinaryClient.scan;
1083 
1084     override
1085     void hscan(string key, string cursor, ScanParams params) {
1086         hscan(SafeEncoder.encode(key), SafeEncoder.encode(cursor), params);
1087     }
1088     alias hscan = BinaryClient.hscan;
1089 
1090     override
1091     void sscan(string key, string cursor, ScanParams params) {
1092         sscan(SafeEncoder.encode(key), SafeEncoder.encode(cursor), params);
1093     }
1094     alias sscan = BinaryClient.sscan;
1095 
1096     override
1097     void zscan(string key, string cursor, ScanParams params) {
1098         zscan(SafeEncoder.encode(key), SafeEncoder.encode(cursor), params);
1099     }
1100     alias zscan = BinaryClient.zscan;
1101 
1102     void cluster(string subcommand, int[] args...) {
1103         const(ubyte)[][] arg = new const(ubyte)[][args.length + 1];
1104         for (int i = 1; i < arg.length; i++) {
1105             arg[i] = toByteArray(args[i - 1]);
1106         }
1107         arg[0] = SafeEncoder.encode(subcommand);
1108         cluster(arg);
1109     }
1110 
1111     void pubsub(string subcommand, string[] args...) {
1112         const(ubyte)[][] arg = new const(ubyte)[][args.length + 1];
1113         for (int i = 1; i < arg.length; i++) {
1114             arg[i] = SafeEncoder.encode(args[i - 1]);
1115         }
1116         arg[0] = SafeEncoder.encode(subcommand);
1117         pubsub(arg);
1118     }
1119         alias pubsub = BinaryClient.pubsub;
1120 
1121     void cluster(string subcommand, string[] args...) {
1122         const(ubyte)[][] arg = new const(ubyte)[][args.length + 1];
1123         for (size_t i = 1; i < arg.length; i++) {
1124             arg[i] = SafeEncoder.encode(args[i - 1]);
1125         }
1126         arg[0] = SafeEncoder.encode(subcommand);
1127         cluster(arg);
1128     }
1129         alias cluster = BinaryClient.cluster;
1130 
1131     void cluster(string subcommand) {
1132         const(ubyte)[][] arg = new const(ubyte)[][1];
1133         arg[0] = SafeEncoder.encode(subcommand);
1134         cluster(arg);
1135     }
1136 
1137     void clusterNodes() {
1138         cluster(Protocol.CLUSTER_NODES);
1139     }
1140 
1141     void clusterMeet(string ip, int port) {
1142         cluster(Protocol.CLUSTER_MEET, ip, to!string(port));
1143     }
1144 
1145     void clusterReset(ClusterReset resetType) {
1146         cluster(Protocol.CLUSTER_RESET, resetType.to!string());
1147     }
1148 
1149     void clusterAddSlots(int[] slots...) {
1150         cluster(Protocol.CLUSTER_ADDSLOTS, slots);
1151     }
1152 
1153     void clusterDelSlots(int[] slots...) {
1154         cluster(Protocol.CLUSTER_DELSLOTS, slots);
1155     }
1156 
1157     void clusterInfo() {
1158         cluster(Protocol.CLUSTER_INFO);
1159     }
1160 
1161     void clusterGetKeysInSlot(int slot, int count) {
1162         int[] args = [slot, count];
1163         cluster(Protocol.CLUSTER_GETKEYSINSLOT, args);
1164     }
1165 
1166     void clusterSetSlotNode(int slot, string nodeId) {
1167         cluster(Protocol.CLUSTER_SETSLOT, to!string(slot), Protocol.CLUSTER_SETSLOT_NODE, nodeId);
1168     }
1169 
1170     void clusterSetSlotMigrating(int slot, string nodeId) {
1171         cluster(Protocol.CLUSTER_SETSLOT, to!string(slot), Protocol.CLUSTER_SETSLOT_MIGRATING,
1172             nodeId);
1173     }
1174 
1175     void clusterSetSlotImporting(int slot, string nodeId) {
1176         cluster(Protocol.CLUSTER_SETSLOT, to!string(slot), Protocol.CLUSTER_SETSLOT_IMPORTING,
1177             nodeId);
1178     }
1179 
1180     void pfadd(string key, string[] elements...) {
1181         pfadd(SafeEncoder.encode(key), SafeEncoder.encodeMany(elements));
1182     }
1183     alias pfadd = BinaryClient.pfadd;
1184 
1185     void pfcount(string key) {
1186         pfcount(SafeEncoder.encode(key));
1187     }
1188     alias pfcount = BinaryClient.pfcount;
1189 
1190     void pfcount(string[] keys...) {
1191         pfcount(SafeEncoder.encodeMany(keys));
1192     }
1193 
1194     void pfmerge(string[] keys...) {
1195         pfcount(SafeEncoder.encodeMany(keys));
1196     }
1197     alias pfmerge = BinaryClient.pfmerge;
1198 
1199     void pfmerge(string destkey, string[] sourcekeys...) {
1200         pfmerge(SafeEncoder.encode(destkey), SafeEncoder.encodeMany(sourcekeys));
1201     }
1202 
1203     void clusterSetSlotStable(int slot) {
1204         cluster(Protocol.CLUSTER_SETSLOT, to!string(slot), Protocol.CLUSTER_SETSLOT_STABLE);
1205     }
1206 
1207     void clusterForget(string nodeId) {
1208         cluster(Protocol.CLUSTER_FORGET, nodeId);
1209     }
1210 
1211     void clusterFlushSlots() {
1212         cluster(Protocol.CLUSTER_FLUSHSLOT);
1213     }
1214 
1215     void clusterKeySlot(string key) {
1216         cluster(Protocol.CLUSTER_KEYSLOT, key);
1217     }
1218 
1219     void clusterCountKeysInSlot(int slot) {
1220         cluster(Protocol.CLUSTER_COUNTKEYINSLOT, to!string(slot));
1221     }
1222 
1223     void clusterSaveConfig() {
1224         cluster(Protocol.CLUSTER_SAVECONFIG);
1225     }
1226 
1227     void clusterReplicate(string nodeId) {
1228         cluster(Protocol.CLUSTER_REPLICATE, nodeId);
1229     }
1230 
1231     void clusterSlaves(string nodeId) {
1232         cluster(Protocol.CLUSTER_SLAVES, nodeId);
1233     }
1234 
1235     void clusterFailover() {
1236         cluster(Protocol.CLUSTER_FAILOVER);
1237     }
1238 
1239     void clusterSlots() {
1240         cluster(Protocol.CLUSTER_SLOTS);
1241     }
1242 
1243     void geoadd(string key, double longitude, double latitude, string member) {
1244         geoadd(SafeEncoder.encode(key), longitude, latitude, SafeEncoder.encode(member));
1245     }
1246     alias geoadd = BinaryClient.geoadd;
1247 
1248     void geoadd(string key, Map!(string, GeoCoordinate) memberCoordinateMap) {
1249         geoadd(SafeEncoder.encode(key), convertMemberCoordinateMapToBinary(memberCoordinateMap));
1250     }
1251 
1252     void geodist(string key, string member1, string member2) {
1253         geodist(SafeEncoder.encode(key), SafeEncoder.encode(member1), SafeEncoder.encode(member2));
1254     }
1255     alias geodist = BinaryClient.geodist;
1256 
1257     void geodist(string key, string member1, string member2, GeoUnit unit) {
1258         geodist(SafeEncoder.encode(key), SafeEncoder.encode(member1), SafeEncoder.encode(member2), unit);
1259     }
1260 
1261     void geohash(string key, string[] members...) {
1262         geohash(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
1263     }
1264     alias geohash = BinaryClient.geohash;
1265 
1266     void geopos(string key, string[] members) {
1267         geopos(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
1268     }
1269     alias geopos = BinaryClient.geopos;
1270 
1271     void georadius(string key, double longitude, double latitude, double radius, GeoUnit unit) {
1272         georadius(SafeEncoder.encode(key), longitude, latitude, radius, unit);
1273     }
1274     alias georadius = BinaryClient.georadius;
1275 
1276     void georadiusReadonly(string key, double longitude, double latitude, double radius, GeoUnit unit) {
1277         georadiusReadonly(SafeEncoder.encode(key), longitude, latitude, radius, unit);
1278     }
1279     alias georadiusReadonly = BinaryClient.georadiusReadonly;
1280 
1281     void georadius(string key, double longitude, double latitude, double radius, GeoUnit unit,
1282             GeoRadiusParam param) {
1283         georadius(SafeEncoder.encode(key), longitude, latitude, radius, unit, param);
1284     }
1285 
1286     void georadiusReadonly(string key, double longitude, double latitude, double radius, GeoUnit unit,
1287             GeoRadiusParam param) {
1288         georadiusReadonly(SafeEncoder.encode(key), longitude, latitude, radius, unit, param);
1289     }
1290 
1291     void georadiusByMember(string key, string member, double radius, GeoUnit unit) {
1292         georadiusByMember(SafeEncoder.encode(key), SafeEncoder.encode(member), radius, unit);
1293     }
1294     alias georadiusByMember = BinaryClient.georadiusByMember;
1295 
1296     void georadiusByMemberReadonly(string key, string member, double radius, GeoUnit unit) {
1297         georadiusByMemberReadonly(SafeEncoder.encode(key), SafeEncoder.encode(member), radius, unit);
1298     }
1299     alias georadiusByMemberReadonly = BinaryClient.georadiusByMemberReadonly;
1300 
1301     void georadiusByMember(string key, string member, double radius, GeoUnit unit,
1302             GeoRadiusParam param) {
1303         georadiusByMember(SafeEncoder.encode(key), SafeEncoder.encode(member), radius, unit, param);
1304     }
1305     alias georadiusByMember = BinaryClient.georadiusByMember;
1306 
1307     void georadiusByMemberReadonly(string key, string member, double radius, GeoUnit unit,
1308             GeoRadiusParam param) {
1309         georadiusByMemberReadonly(SafeEncoder.encode(key), SafeEncoder.encode(member), radius, unit, param);
1310     }
1311     alias georadiusByMemberReadonly = BinaryClient.georadiusByMemberReadonly;
1312 
1313     void moduleLoad(string path) {
1314         moduleLoad(SafeEncoder.encode(path));
1315     }
1316     alias moduleLoad = BinaryClient.moduleLoad;
1317 
1318     void moduleUnload(string name) {
1319         moduleUnload(SafeEncoder.encode(name));
1320     }
1321     alias moduleUnload = BinaryClient.moduleUnload;
1322 
1323     private HashMap!(const(ubyte)[], double) convertScoreMembersToBinary(Map!(string, double) scoreMembers) {
1324         HashMap!(const(ubyte)[], double) binaryScoreMembers = new HashMap!(const(ubyte)[], double)();
1325         foreach(string key, double value; scoreMembers) {
1326             binaryScoreMembers.put(SafeEncoder.encode(key), value);
1327         }
1328         return binaryScoreMembers;
1329     }
1330 
1331     private HashMap!(const(ubyte)[], GeoCoordinate) convertMemberCoordinateMapToBinary(
1332             Map!(string, GeoCoordinate) memberCoordinateMap) {
1333         HashMap!(const(ubyte)[], GeoCoordinate) binaryMemberCoordinateMap = new HashMap!(const(ubyte)[], GeoCoordinate)();
1334         foreach(string key, GeoCoordinate value; memberCoordinateMap) {
1335             binaryMemberCoordinateMap.put(SafeEncoder.encode(key), value);
1336         }
1337         return binaryMemberCoordinateMap;
1338     }
1339 
1340     override
1341     void bitfield(string key, string[] arguments...) {
1342         bitfield(SafeEncoder.encode(key), SafeEncoder.encodeMany(arguments));
1343     }
1344     alias bitfield = BinaryClient.bitfield;
1345 
1346     override
1347     void hstrlen(string key, string field) {
1348         hstrlen(SafeEncoder.encode(key), SafeEncoder.encode(field));
1349     }
1350     alias hstrlen = BinaryClient.hstrlen;
1351 
1352     override
1353     void xadd(string key,  StreamEntryID id, Map!(string, string) hash, long maxLen, bool approximateLength) {
1354         Map!(const(ubyte)[], const(ubyte)[]) bhash = new HashMap!(const(ubyte)[], const(ubyte)[])(hash.size());
1355         foreach(string k, string v; hash) {
1356             bhash.put(SafeEncoder.encode(k), SafeEncoder.encode(v));
1357         }
1358         xadd(SafeEncoder.encode(key), SafeEncoder.encode(id is null ? "*" : id.toString()), bhash, maxLen, approximateLength);
1359     }
1360     alias xadd = BinaryClient.xadd;
1361     
1362     override
1363     void xlen(string key) {
1364             xlen(SafeEncoder.encode(key));
1365     }
1366     alias xlen = BinaryClient.xlen;
1367     
1368     override
1369     void xrange(string key, StreamEntryID start,  StreamEntryID end, long count) {
1370             xrange(SafeEncoder.encode(key), SafeEncoder.encode(start is null ? "-" : start.toString()), 
1371             SafeEncoder.encode(end is null ? "+" : end.toString()), count);
1372     }
1373     alias xrange = BinaryClient.xrange;
1374     
1375     override
1376     void xrevrange(string key, StreamEntryID end, StreamEntryID start, int count) {
1377         xrevrange(SafeEncoder.encode(key), SafeEncoder.encode(end is null ? "+" : end.toString()), 
1378             SafeEncoder.encode(start is null ? "-" : start.toString()), count);
1379     }
1380     alias xrevrange = BinaryClient.xrevrange;
1381     
1382     override
1383     void xread(int count, long block, MapEntry!(string, StreamEntryID)[] streams...) {
1384         Map!(const(ubyte)[], const(ubyte)[]) bhash = new HashMap!(const(ubyte)[], const(ubyte)[])(cast(int)streams.length);
1385         foreach(MapEntry!(string, StreamEntryID) entry ; streams) {
1386             bhash.put(SafeEncoder.encode(entry.getKey()), 
1387             SafeEncoder.encode(entry.getValue() is null ? "0-0" : entry.getValue().toString()));
1388         }
1389         xread(count, block, bhash);
1390     }
1391     alias xread = BinaryClient.xread;
1392     
1393     override
1394     void xack(string key, string group, StreamEntryID[] ids...) {
1395         const(ubyte)[][] bids = new const(ubyte)[][ids.length];
1396         for (int i=0 ; i< ids.length; ++i ) {
1397             StreamEntryID id = ids[i];
1398             bids[i] = SafeEncoder.encode(id is null ? "0-0" : id.toString()); 
1399         }
1400         xack(SafeEncoder.encode(key), SafeEncoder.encode(group), bids);
1401     }
1402     alias xack = BinaryClient.xack;
1403     
1404     override
1405     void xgroupCreate(string key, string groupname, StreamEntryID id, bool makeStream) {
1406         xgroupCreate(SafeEncoder.encode(key), SafeEncoder.encode(groupname), SafeEncoder.encode(id is null ? "0-0" : id.toString()), makeStream);
1407     }
1408     alias xgroupCreate = BinaryClient.xgroupCreate;
1409 
1410     override
1411     void xgroupSetID(string key, string groupname, StreamEntryID id) {
1412         xgroupSetID(SafeEncoder.encode(key), SafeEncoder.encode(groupname), SafeEncoder.encode(id is null ? "0-0" : id.toString()));    
1413     }
1414     alias xgroupSetID = BinaryClient.xgroupSetID;
1415 
1416     override
1417     void xgroupDestroy(string key, string groupname) {
1418         xgroupDestroy(SafeEncoder.encode(key), SafeEncoder.encode(groupname));    
1419     }
1420     alias xgroupDestroy = BinaryClient.xgroupDestroy;
1421 
1422     override
1423     void xgroupDelConsumer(string key, string groupname, string consumerName) {
1424         xgroupDelConsumer(SafeEncoder.encode(key), SafeEncoder.encode(groupname), SafeEncoder.encode(consumerName));    
1425     }
1426     alias xgroupDelConsumer = BinaryClient.xgroupDelConsumer;
1427 
1428     override
1429     void xdel(string key, StreamEntryID[] ids...) {
1430         const(ubyte)[][] bids = new const(ubyte)[][ids.length];
1431         for (int i=0 ; i< ids.length; ++i ) {
1432             StreamEntryID id = ids[i];
1433             bids[i] = SafeEncoder.encode(id is null ? "0-0" : id.toString()); 
1434         }
1435         xdel(SafeEncoder.encode(key), bids);    
1436     }
1437     alias xdel = BinaryClient.xdel;
1438 
1439     override
1440     void xtrim(string key, long maxLen, bool approximateLength) {
1441         xtrim(SafeEncoder.encode(key), maxLen, approximateLength);    
1442     }
1443     alias xtrim = BinaryClient.xtrim;
1444 
1445     override
1446     void xreadGroup(string groupname, string consumer, int count, long block, 
1447                                     bool noAck, MapEntry!(string, StreamEntryID)[] streams...) {
1448         Map!(const(ubyte)[], const(ubyte)[]) bhash = new HashMap!(const(ubyte)[], const(ubyte)[])(cast(int)streams.length);
1449         foreach(MapEntry!(string, StreamEntryID) entry ; streams) {
1450             bhash.put(SafeEncoder.encode(entry.getKey()), SafeEncoder.encode(entry.getValue() is null ? ">" : entry.getValue().toString()));
1451         }
1452         xreadGroup(SafeEncoder.encode(groupname), SafeEncoder.encode(consumer), count, block, noAck, bhash);    
1453     }
1454     alias xreadGroup = BinaryClient.xreadGroup;
1455 
1456     override
1457     void xpending(string key, string groupname, StreamEntryID start, StreamEntryID end, int count, string consumername) {
1458         xpending(SafeEncoder.encode(key), SafeEncoder.encode(groupname), SafeEncoder.encode(start is null ? "-" : start.toString()),
1459                 SafeEncoder.encode(end is null ? "+" : end.toString()), count, consumername is null? null : SafeEncoder.encode(consumername));    
1460     }
1461     alias xpending = BinaryClient.xpending;
1462 
1463     override
1464     void xclaim(string key, string group, string consumername, long minIdleTime, long newIdleTime, int retries,
1465             bool force, StreamEntryID[] ids...) {
1466         
1467         const(ubyte)[][] bids = new const(ubyte)[][ids.length];
1468         for (int i = 0; i < ids.length; i++) {
1469             bids[i] = SafeEncoder.encode(ids[i].toString());
1470         }
1471         xclaim(SafeEncoder.encode(key), SafeEncoder.encode(group), SafeEncoder.encode(consumername), 
1472             minIdleTime, newIdleTime, retries, force, bids);    
1473     }
1474     alias xclaim = BinaryClient.xclaim;
1475 
1476     override void bgrewriteaof() { super.bgrewriteaof(); }
1477 
1478     override void bgsave() { super.bgsave(); }
1479 
1480     override void lastsave() { super.lastsave(); }
1481 
1482     override void save() { super.save(); }
1483 
1484     override void configResetStat() { super.configResetStat(); }
1485 
1486     override void multi() { super.multi(); }
1487 
1488     override void exec() { super.exec(); }
1489 
1490     override void discard() { super.discard(); }
1491 
1492 
1493     override void waitReplicas(int replicas, long timeout) { super.waitReplicas(replicas, timeout); }
1494 
1495     override void clientKill(string ip, int port) { super.clientKill(ip, port); }
1496 
1497     override void clientKill(ClientKillParams params) { super.clientKill(params); }
1498 
1499     override void clientGetname() { super.clientGetname(); }
1500     
1501     override void clientList() { super.discard(); }
1502 
1503     override void memoryDoctor() { super.discard(); }
1504 
1505 }