Skip to content

Commit e3a8706

Browse files
authored
js highlighting
1 parent cc48de8 commit e3a8706

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,11 @@ Note that this program will not exit cleanly because the client is still connect
773773
To execute redis multi-word commands like `SCRIPT LOAD` or `CLIENT LIST` pass
774774
the second word as first parameter:
775775

776-
client.script('load', 'return 1');
777-
client.multi().script('load', 'return 1').exec(...);
778-
client.multi([['script', 'load', 'return 1']]).exec(...);
776+
```js
777+
client.script('load', 'return 1');
778+
client.multi().script('load', 'return 1').exec(...);
779+
client.multi([['script', 'load', 'return 1']]).exec(...);
780+
```
779781

780782
## client.duplicate([options][, callback])
781783

@@ -790,24 +792,26 @@ blocking redis commands BRPOP, BLPOP, and BRPOPLPUSH. If these commands
790792
are used on the same redisClient instance as non-blocking commands, the
791793
non-blocking ones may be queued up until after the blocking ones finish.
792794

793-
var Redis=require('redis');
794-
var client = Redis.createClient();
795-
var clientBlocking = client.duplicate();
796-
797-
var get = function() {
798-
console.log("get called");
799-
client.get("any_key",function() { console.log("get returned"); });
800-
setTimeout( get, 1000 );
801-
};
802-
var brpop = function() {
803-
console.log("brpop called");
804-
clientBlocking.brpop("nonexistent", 5, function() {
805-
console.log("brpop return");
806-
setTimeout( brpop, 1000 );
807-
});
808-
};
809-
get();
810-
brpop();
795+
```js
796+
var Redis=require('redis');
797+
var client = Redis.createClient();
798+
var clientBlocking = client.duplicate();
799+
800+
var get = function() {
801+
console.log("get called");
802+
client.get("any_key",function() { console.log("get returned"); });
803+
setTimeout( get, 1000 );
804+
};
805+
var brpop = function() {
806+
console.log("brpop called");
807+
clientBlocking.brpop("nonexistent", 5, function() {
808+
console.log("brpop return");
809+
setTimeout( brpop, 1000 );
810+
});
811+
};
812+
get();
813+
brpop();
814+
```
811815

812816
Another reason to use duplicate() is when multiple DBs on the same server are
813817
accessed via the redis SELECT command. Each DB could use its own connection.

0 commit comments

Comments
 (0)