get_cached

Function get_cached 

Source
pub async fn get_cached(
    __arg0: State<AppState>,
    __arg1: Path<String>,
) -> Result<Response, ApiError>
Expand description

GET /api/v1/cache/:key - Retrieve a cached POST /api/v1/parse result.

key is the cache_key that route returned, which is the value the client’s getCached(result.cache_key) passes, resolved by resolve_request_cache_key. The response itself is stored under json_response_cache_key ({cache_key}-json-v6), versioned separately so the JSON wire format can move without retiring the Parquet entries that share the same seed (#5542).

Only JSON response entries are reachable here: an entry that exists but does not decode answers 404, not 500 (#5128). Reading the bytes directly (rather than through DiskCache::get, whose ? cannot tell that failure apart from a real I/O error) keeps an actual cache-store error a 500.

Decoded as SymbolicParseResponse, the type the writer stored. The entry is the whole model, so the read, decode and re-encode hold a parse admission slot, reserved exactly as the parse route reserves one, and run on the blocking pool (#4696, #5750): without the slot, concurrent GETs of a large model were an unbounded number of whole-model working sets. The slot travels with the blocking decode, not with this handler, so a client that hangs up mid-decode does not free it while the decode runs on. A miss is answered from the index before any slot is taken, so a key nobody wrote costs one metadata lookup, like the hash-only probes (#3901).