Set a bunch of values in the cache at once from a dict of key/value pairs. For certain backends (memcached), this is much more efficient than calling set() multiple times. If timeout is given, use that timeout for the key; otherwise use the default cache tim
(self, data, timeout=DEFAULT_TIMEOUT, version=None)
| 317 | return self.has_key(key) |
| 318 | |
| 319 | def set_many(self, data, timeout=DEFAULT_TIMEOUT, version=None): |
| 320 | """ |
| 321 | Set a bunch of values in the cache at once from a dict of key/value |
| 322 | pairs. For certain backends (memcached), this is much more efficient |
| 323 | than calling set() multiple times. |
| 324 | |
| 325 | If timeout is given, use that timeout for the key; otherwise use the |
| 326 | default cache timeout. |
| 327 | |
| 328 | On backends that support it, return a list of keys that failed |
| 329 | insertion, or an empty list if all keys were inserted successfully. |
| 330 | """ |
| 331 | for key, value in data.items(): |
| 332 | self.set(key, value, timeout=timeout, version=version) |
| 333 | return [] |
| 334 | |
| 335 | async def aset_many(self, data, timeout=DEFAULT_TIMEOUT, version=None): |
| 336 | if self.set_many.__func__ is not BaseCache.set_many: |