MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / get

Method get

tests/api/mocks.py:350–360  ·  view source on GitHub ↗

Retrieve value from cache. If `key` is missing, return `default`. When `read` is True, return a file handle to value. Note: other diskcache arguments are ignored.

(self, key, default=None, read=False, **kwargs)

Source from the content-addressed store, hash-verified

348 """
349
350 def get(self, key, default=None, read=False, **kwargs):
351 """Retrieve value from cache. If `key` is missing, return `default`.
352
353 When `read` is True, return a file handle to value.
354
355 Note: other diskcache arguments are ignored.
356 """
357 value = super().get(key, default)
358 if value is not None and read:
359 value = io.BytesIO(value)
360 return value
361
362 def set(self, key, value, read=False, **kwargs):
363 """Set `key` and `value` item in cache.

Calls

no outgoing calls