MCPcopy
hub / github.com/django/django / get_many

Method get_many

django/core/cache/backends/base.py:194–207  ·  view source on GitHub ↗

Fetch a bunch of keys from the cache. For certain backends (memcached, pgsql) this can be *much* faster when fetching multiple values. Return a dict mapping each key in keys to its value. If the given key is missing, it will be missing from the response dict.

(self, keys, version=None)

Source from the content-addressed store, hash-verified

192 return await sync_to_async(self.delete, thread_sensitive=True)(key, version)
193
194 def get_many(self, keys, version=None):
195 """
196 Fetch a bunch of keys from the cache. For certain backends (memcached,
197 pgsql) this can be *much* faster when fetching multiple values.
198
199 Return a dict mapping each key in keys to its value. If the given
200 key is missing, it will be missing from the response dict.
201 """
202 d = {}
203 for k in keys:
204 val = self.get(k, self._missing_key, version=version)
205 if val is not self._missing_key:
206 d[k] = val
207 return d
208
209 async def aget_many(self, keys, version=None):
210 """See get_many()."""

Callers 5

test_get_manyMethod · 0.45
test_get_manyMethod · 0.45

Calls 1

getMethod · 0.95

Tested by 5

test_get_manyMethod · 0.36
test_get_manyMethod · 0.36