You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// set a prefix for the keys stored in redis. This way you can avoid key
12
16
// collisions for different data-sets in your redis instance.
13
17
'redis-key-prefix',
@@ -23,12 +27,77 @@ const redisDataLoader = new RedisDataLoader(
23
27
expire:60
24
28
}
25
29
);
30
+
31
+
// load an individual item by its key
32
+
loader.load(5).then(resp=>console.log(resp));
33
+
34
+
//clear an individiaul item from the local and redis cache.
35
+
loader.clear(5).then(() => {})
26
36
```
27
37
38
+
## API Documentation
39
+
28
40
In general, RedisDataLoader has the same API as the Facebook Dataloader Api,
29
-
with a few differences.
41
+
with a few differences. Read through the [Facebook Dataloader documentation](https://github.com/facebook/dataloader) and then note the differences mentioned here.
30
42
31
43
-`clear` returns a promise (waits until redis succeeds at deleting the key)
32
44
-`clearAll` is not available (redis does not have an efficient way to do this?)
33
45
-`prime` will always overwrite the redis cache. It in turn calls prime on the local cache (which does not adjust the cache if the key already exists)
34
46
- dataloader results must be either `null` or a JSON object.
0 commit comments