Return the deserialised value for *bank*/*key*, or ``{}`` if not found.
(bank, key, cachedir, **kwargs)
| 202 | |
| 203 | |
| 204 | def fetch(bank, key, cachedir, **kwargs): |
| 205 | """ |
| 206 | Return the deserialised value for *bank*/*key*, or ``{}`` if not found. |
| 207 | """ |
| 208 | cache = _get_cache(bank, cachedir) |
| 209 | raw = cache.get(key, default=None) |
| 210 | |
| 211 | if raw is None: |
| 212 | return {} |
| 213 | |
| 214 | # set-mode entries (value=True) indicate presence without data |
| 215 | if raw is True: |
| 216 | return {} |
| 217 | |
| 218 | if isinstance(raw, str): |
| 219 | raw = raw.encode() |
| 220 | |
| 221 | try: |
| 222 | return msgpack.unpackb(raw, **_UNPACK_OPTS) |
| 223 | except Exception as exc: # pylint: disable=broad-except |
| 224 | raise SaltCacheError( |
| 225 | f"Failed to deserialise cache data for bank={bank!r} key={key!r}: {exc}" |
| 226 | ) |
| 227 | |
| 228 | |
| 229 | def updated(bank, key, cachedir, **kwargs): |
nothing calls this directly
no test coverage detected