@@ -79,13 +79,37 @@ redisCache.wrap(key, function (cb) {
79
79
// The del() method accepts a single key or array of keys,
80
80
// with or without a callback.
81
81
redisCache .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
+ });
86
87
});
87
- });
88
88
});
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
+
89
113
```
90
114
91
115
### Multi-store
0 commit comments