Loads multiple keys, returning a list of values >>> a, b = await my_loader.load_many([ 'a', 'b' ]) This is equivalent to the more verbose: >>> a, b = await gather( >>> my_loader.load('a'), >>> my_loader.load('b') >>> )
(self, keys)
| 115 | dispatch_queue(self) # pragma: no cover |
| 116 | |
| 117 | def load_many(self, keys): |
| 118 | """ |
| 119 | Loads multiple keys, returning a list of values |
| 120 | |
| 121 | >>> a, b = await my_loader.load_many([ 'a', 'b' ]) |
| 122 | |
| 123 | This is equivalent to the more verbose: |
| 124 | |
| 125 | >>> a, b = await gather( |
| 126 | >>> my_loader.load('a'), |
| 127 | >>> my_loader.load('b') |
| 128 | >>> ) |
| 129 | """ |
| 130 | if not isinstance(keys, Iterable): |
| 131 | raise TypeError( # pragma: no cover |
| 132 | ( |
| 133 | "The loader.load_many() function must be called with Iterable<key> " |
| 134 | "but got: {}." |
| 135 | ).format(keys) |
| 136 | ) |
| 137 | |
| 138 | return gather(*[self.load(key) for key in keys]) |
| 139 | |
| 140 | def clear(self, key): |
| 141 | """ |