@@ -79,13 +79,37 @@ redisCache.wrap(key, function (cb) {
7979// The del() method accepts a single key or array of keys,
8080// with or without a callback.
8181redisCache .set (' foo' , ' bar' , function () {
82- redisCache .set (' bar' , ' baz' , function () {
83- redisCache .set (' baz' , ' foo' , function () {
84- redisCache .del (' foo' );
85- redisCache .del ([' bar' , ' baz' ], function () { });
82+ redisCache .set (' bar' , ' baz' , function () {
83+ redisCache .set (' baz' , ' foo' , function () {
84+ redisCache .del (' foo' );
85+ redisCache .del ([' bar' , ' baz' ], function () { });
86+ });
8687 });
87- });
8888});
89+
90+ // The keys() method uses the Redis SCAN command and accepts
91+ // optional `pattern` and `options` arguments. The `pattern`
92+ // must be a Redis glob-style string and defaults to '*'. The
93+ // options argument must be an object and accepts a single
94+ // `scanCount` property, which determines the number of elements
95+ // returned internally per call to SCAN. The default `scanCount`
96+ // is 100.
97+ redisCache .set (' foo' , ' bar' , function () {
98+ redisCache .set (' far' , ' boo' , function () {
99+ redisCache .keys (' fo*' , function (err , arrayOfKeys ) {
100+ // arrayOfKeys: ['foo']
101+ });
102+
103+ redisCache .keys (function (err , arrayOfKeys ) {
104+ // arrayOfKeys: ['foo', 'far']
105+ });
106+
107+ redisCache .keys (' fa*' , { scanCount: 10 }, function (err , arrayOfKeys ) {
108+ // arrayOfKeys: ['far']
109+ });
110+ });
111+ });
112+
89113```
90114
91115### Multi-store
0 commit comments