十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这篇文章主要讲解了“Client.java的源码是什么”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Client.java的源码是什么”吧!
成都创新互联公司是一家专业的成都网站建设公司,我们专注成都网站设计、网站建设、网络营销、企业网站建设,外链,广告投放为企业客户提供一站式建站解决方案,能带给客户新的互联网理念。从网站结构的规划UI设计到用户体验提高,创新互联力求做到尽善尽美。
基本都是发文件,通过调用sendcommand函数,这个函数在connection类内。
package redis.clients.jedis; import java.util.ArrayList; import java.util.List; import java.util.Map; public class Client extends Connection { private boolean isInMulti; //标志是否多命令执行状态 public boolean isInMulti() {//返回命令状态 return isInMulti; } public Client(String host) {//初始化父类connection super(host); } public Client(String host, int port) {//用ip/端口初始化父类 super(host, port); } public void ping() {//发送PING命令 sendCommand("PING"); } public void set(String key, String value) {//发送set命令 sendCommand("SET", key, value); } public void get(String key) {//发送get命令 sendCommand("GET", key); } public void quit() {//发送quit命令 sendCommand("QUIT"); } public void exists(String key) {//发送exists命令 sendCommand("EXISTS", key); } public void del(String... keys) {//发送del命令 sendCommand("DEL", keys); } public void type(String key) {//发送type命令 sendCommand("TYPE", key); } public void flushDB() {//发送flushdb命令 sendCommand("FLUSHDB"); } public void keys(String pattern) {//发送keys命令 sendCommand("KEYS", pattern); } public void randomKey() {//发送randomkey命令 sendCommand("RANDOMKEY"); } public void rename(String oldkey, String newkey) {//发送rename命令 sendCommand("RENAME", oldkey, newkey); } public void renamenx(String oldkey, String newkey) {//发送renamenx命令 sendCommand("RENAMENX", oldkey, newkey); } public void dbSize() {//发送dbsize命令 sendCommand("DBSIZE"); } public void expire(String key, int seconds) {//发送expire命令 sendCommand("EXPIRE", key, String.valueOf(seconds)); } public void expireAt(String key, long unixTime) {//发送expireat命令 sendCommand("EXPIREAT", key, String.valueOf(unixTime)); } public void ttl(String key) {//发送ttl命令 sendCommand("TTL", key); } public void select(int index) {//发送select命令 sendCommand("SELECT", String.valueOf(index)); } public void move(String key, int dbIndex) {//发送move命令 sendCommand("MOVE", key, String.valueOf(dbIndex)); } public void flushAll() {//发送flushall命令 sendCommand("FLUSHALL"); } public void getSet(String key, String value) {//发送getset命令 sendCommand("GETSET", key, value); } public void mget(String... keys) {//发送mget命令 sendCommand("MGET", keys); } public void setnx(String key, String value) {//发送命令setnx sendCommand("SETNX", key, value); } public void setex(String key, int seconds, String value) {//发送命令setex sendCommand("SETEX", key, String.valueOf(seconds), value); } public void mset(String... keysvalues) {//发送命令mset sendCommand("MSET", keysvalues); } public void msetnx(String... keysvalues) {//发送命令msetnx sendCommand("MSETNX", keysvalues); } public void decrBy(String key, int integer) {//发送命令decrby sendCommand("DECRBY", key, String.valueOf(integer)); } public void decr(String key) {//发送命令decr sendCommand("DECR", key); } public void incrBy(String key, int integer) {//发送命令incrby sendCommand("INCRBY", key, String.valueOf(integer)); } public void incr(String key) {//发送命令incr sendCommand("INCR", key); } public void append(String key, String value) {//发送命令append sendCommand("APPEND", key, value); } public void substr(String key, int start, int end) {//发送命令substr sendCommand("SUBSTR", key, String.valueOf(start), String.valueOf(end)); } public void hset(String key, String field, String value) {//发送命令hset sendCommand("HSET", key, field, value); } public void hget(String key, String field) {//发送命令hget sendCommand("HGET", key, field); } public void hsetnx(String key, String field, String value) {//发送命令hsetnx sendCommand("HSETNX", key, field, value); } public void hmset(String key, Maphash) {//发送命令hmset List params = new ArrayList (); params.add(key); for (String field : hash.keySet()) { params.add(field); params.add(hash.get(field)); } sendCommand("HMSET", params.toArray(new String[params.size()])); } public void hmget(String key, String... fields) {//发送命令hmget String[] params = new String[fields.length + 1]; params[0] = key; System.arraycopy(fields, 0, params, 1, fields.length); sendCommand("HMGET", params); } public void hincrBy(String key, String field, int value) {//发送命令hincrby sendCommand("HINCRBY", key, field, String.valueOf(value)); } public void hexists(String key, String field) {//发送命令hexists sendCommand("HEXISTS", key, field); } public void hdel(String key, String field) {//发送命令hdel sendCommand("HDEL", key, field); } public void hlen(String key) {//发送命令hlen sendCommand("HLEN", key); } public void hkeys(String key) {//发送命令hkeys sendCommand("HKEYS", key); } public void hvals(String key) {//发送命令hvals sendCommand("HVALS", key); } public void hgetAll(String key) {//发送命令hgetall sendCommand("HGETALL", key); } public void rpush(String key, String string) {//发送命令rpush sendCommand("RPUSH", key, string); } public void lpush(String key, String string) {//发送命令lpush sendCommand("LPUSH", key, string); } public void llen(String key) {//发送命令llen sendCommand("LLEN", key); } public void lrange(String key, int start, int end) {//发送命令lrange sendCommand("LRANGE", key, String.valueOf(start), String.valueOf(end)); } public void ltrim(String key, int start, int end) {//发送命令ltrim sendCommand("LTRIM", key, String.valueOf(start), String.valueOf(end)); } public void lindex(String key, int index) {//发送命令lindex sendCommand("LINDEX", key, String.valueOf(index)); } public void lset(String key, int index, String value) {//发送命令lset sendCommand("LSET", key, String.valueOf(index), value); } public void lrem(String key, int count, String value) {//发送命令lrem sendCommand("LREM", key, String.valueOf(count), value); } public void lpop(String key) {//发送命令lpop sendCommand("LPOP", key); } public void rpop(String key) {//发送命令rpop sendCommand("RPOP", key); } public void rpoplpush(String srckey, String dstkey) {//发送命令rpoplpush sendCommand("RPOPLPUSH", srckey, dstkey); } public void sadd(String key, String member) {//发送命令sadd sendCommand("SADD", key, member); } public void smembers(String key) {//发送命令smembers sendCommand("SMEMBERS", key); } public void srem(String key, String member) {//发送命令srem sendCommand("SREM", key, member); } public void spop(String key) {//发送命令spop sendCommand("SPOP", key); } public void smove(String srckey, String dstkey, String member) {//发送命令smove sendCommand("SMOVE", srckey, dstkey, member); } public void scard(String key) {//发送命令scard sendCommand("SCARD", key); } public void sismember(String key, String member) {//发送命令sismember sendCommand("SISMEMBER", key, member); } public void sinter(String... keys) {//发送命令sinter sendCommand("SINTER", keys); } public void sinterstore(String dstkey, String... keys) {//发送命令sinterstore String[] params = new String[keys.length + 1]; params[0] = dstkey; System.arraycopy(keys, 0, params, 1, keys.length); sendCommand("SINTERSTORE", params); } public void sunion(String... keys) {//发送命令sunion sendCommand("SUNION", keys); } public void sunionstore(String dstkey, String... keys) {//发送命令sunionstore String[] params = new String[keys.length + 1]; params[0] = dstkey; System.arraycopy(keys, 0, params, 1, keys.length); sendCommand("SUNIONSTORE", params); } public void sdiff(String... keys) {//发送命令sdiff sendCommand("SDIFF", keys); } public void sdiffstore(String dstkey, String... keys) {//发送命令sdiffstore String[] params = new String[keys.length + 1]; params[0] = dstkey; System.arraycopy(keys, 0, params, 1, keys.length); sendCommand("SDIFFSTORE", params); } public void srandmember(String key) {//发送命令srandmember sendCommand("SRANDMEMBER", key); } public void zadd(String key, double score, String member) {//发送命令zadd sendCommand("ZADD", key, String.valueOf(score), member); } public void zrange(String key, int start, int end) {//发送命令zrange sendCommand("ZRANGE", key, String.valueOf(start), String.valueOf(end)); } public void zrem(String key, String member) {//发送命令zrem sendCommand("ZREM", key, member); } public void zincrby(String key, double score, String member) {//发送命令zincrby sendCommand("ZINCRBY", key, String.valueOf(score), member); } public void zrank(String key, String member) {//发送命令zrank sendCommand("ZRANK", key, member); } public void zrevrank(String key, String member) {//发送命令zrevrank sendCommand("ZREVRANK", key, member); } public void zrevrange(String key, int start, int end) {//发送命令zrevrange sendCommand("ZREVRANGE", key, String.valueOf(start), String .valueOf(end)); } public void zrangeWithScores(String key, int start, int end) {//发送命令zrange sendCommand("ZRANGE", key, String.valueOf(start), String.valueOf(end), "WITHSCORES"); } public void zrevrangeWithScores(String key, int start, int end) {//发送命令zrevrange sendCommand("ZREVRANGE", key, String.valueOf(start), String .valueOf(end), "WITHSCORES"); } public void zcard(String key) {//发送命令zcard sendCommand("ZCARD", key); } public void zscore(String key, String member) {//发送命令zscore sendCommand("ZSCORE", key, member); } public void multi() {//发送命令multi sendCommand("MULTI"); isInMulti = true; } public void discard() {//发送命令discard sendCommand("DISCARD"); isInMulti = false; } public void exec() {//发送命令exec sendCommand("EXEC"); isInMulti = false; } public void watch(String key) {//发送命令watch sendCommand("WATCH", key); } public void unwatch() {//发送命令unwatch sendCommand("UNWATCH"); } public void sort(String key) {//发送命令sort sendCommand("SORT", key); } public void sort(String key, SortingParams sortingParameters) {//发送命令sort List args = new ArrayList (); args.add(key); args.addAll(sortingParameters.getParams()); sendCommand("SORT", args.toArray(new String[args.size()])); } public void blpop(String[] args) {//发送命令blpop sendCommand("BLPOP", args); } public void sort(String key, SortingParams sortingParameters, String dstkey) {//发送命令sort List args = new ArrayList (); args.add(key); args.addAll(sortingParameters.getParams()); args.add("STORE"); args.add(dstkey); sendCommand("SORT", args.toArray(new String[args.size()])); } public void sort(String key, String dstkey) {//发送命令sort,store sendCommand("SORT", key, "STORE", dstkey); } public void brpop(String[] args) {//发送命令brpop sendCommand("BRPOP", args); } public void auth(String password) {//发送命令auth sendCommand("AUTH", password); } public void subscribe(String... channels) {//发送命令subscribe sendCommand("SUBSCRIBE", channels); } public void publish(String channel, String message) {//发送命令publish sendCommand("PUBLISH", channel, message); } public void unsubscribe() {//发送命令unsubscribe sendCommand("UNSUBSCRIBE"); } public void unsubscribe(String... channels) {//发送命令unsubscribe sendCommand("UNSUBSCRIBE", channels); } public void psubscribe(String[] patterns) {//发送命令psubscribe sendCommand("PSUBSCRIBE", patterns); } public void punsubscribe() {//发送命令punsubscribe sendCommand("PUNSUBSCRIBE"); } public void punsubscribe(String... patterns) {//发送命令punsubscribe sendCommand("PUNSUBSCRIBE", patterns); } public void zcount(String key, double min, double max) {//发送命令zcount sendCommand("ZCOUNT", key, String.valueOf(min), String.valueOf(max)); } public void zrangeByScore(String key, double min, double max) {//发送命令zrangebyscore sendCommand("ZRANGEBYSCORE", key, String.valueOf(min), String .valueOf(max)); } public void zrangeByScore(String key, double min, double max, int offset, int count) {//发送命令zrangebyscore sendCommand("ZRANGEBYSCORE", key, String.valueOf(min), String .valueOf(max), "LIMIT", String.valueOf(offset), String .valueOf(count)); } public void zrangeByScoreWithScores(String key, double min, double max) {//发送命令zrangebyscore sendCommand("ZRANGEBYSCORE", key, String.valueOf(min), String .valueOf(max), "WITHSCORES"); } public void zrangeByScoreWithScores(String key, double min, double max, int offset, int count) {//发送命令zrangebyscore sendCommand("ZRANGEBYSCORE", key, String.valueOf(min), String .valueOf(max), "LIMIT", String.valueOf(offset), String .valueOf(count), "WITHSCORES"); } public void zremrangeByRank(String key, int start, int end) {//发送命令zremrangebyrank sendCommand("ZREMRANGEBYRANK", key, String.valueOf(start), String .valueOf(end)); } public void zremrangeByScore(String key, double start, double end) {//发送命令zremrangebyscore sendCommand("ZREMRANGEBYSCORE", key, String.valueOf(start), String .valueOf(end)); } public void zunionstore(String dstkey, String... sets) {//发送命令zunionstore String[] params = new String[sets.length + 2]; params[0] = dstkey; params[1] = String.valueOf(sets.length); System.arraycopy(sets, 0, params, 2, sets.length); sendCommand("ZUNIONSTORE", params); } public void zunionstore(String dstkey, ZParams params, String... sets) {//发送命令zunionstore List args = new ArrayList (); args.add(dstkey); args.add(String.valueOf(sets.length)); for (String set : sets) { args.add(set); } args.addAll(params.getParams()); sendCommand("ZUNIONSTORE", args.toArray(new String[args.size()])); } public void zinterstore(String dstkey, String... sets) {//发送命令zinterstore String[] params = new String[sets.length + 2]; params[0] = dstkey; params[1] = String.valueOf(sets.length); System.arraycopy(sets, 0, params, 2, sets.length); sendCommand("ZINTERSTORE", params); } public void zinterstore(String dstkey, ZParams params, String... sets) {//发送命令zinterstore List args = new ArrayList (); args.add(dstkey); args.add(String.valueOf(sets.length)); for (String set : sets) { args.add(set); } args.addAll(params.getParams()); sendCommand("ZINTERSTORE", args.toArray(new String[args.size()])); } public void save() {//发送命令save sendCommand("SAVE"); } public void bgsave() {//发送命令bgsave sendCommand("BGSAVE"); } public void bgrewriteaof() {//发送命令bgrewriteaof sendCommand("BGREWRITEAOF"); } public void lastsave() {//发送命令lastsave sendCommand("LASTSAVE"); } public void shutdown() {//发送命令shutdown sendCommand("SHUTDOWN"); } public void info() {//发送命令info sendCommand("INFO"); } public void monitor() {//发送命令monitor sendCommand("MONITOR"); } public void slaveof(String host, int port) {//发送命令slaveof sendCommand("SLAVEOF", host, String.valueOf(port)); } public void slaveofNoOne() {//发送命令slaveof sendCommand("SLAVEOF", "no", "one"); } public void configGet(String pattern) {//发送命令config get sendCommand("CONFIG", "GET", pattern); } public void configSet(String parameter, String value) {//发送命令config set sendCommand("CONFIG", "SET", parameter, value); } }
感谢各位的阅读,以上就是“Client.java的源码是什么”的内容了,经过本文的学习后,相信大家对Client.java的源码是什么这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!