[−][src]Function rustc_query_system::query::plumbing::try_get_cached

pub(in query::plumbing) fn try_get_cached<CTX, C, R, OnHit, OnMiss>(
    tcx: CTX,
    state: &QueryState<CTX::DepKind, CTX::Query, C>,
    key: C::Key,
    on_hit: OnHit,
    on_miss: OnMiss
) -> R where
    C: QueryCache,
    CTX: QueryContext,
    OnHit: FnOnce(&C::Stored, DepNodeIndex) -> R,
    OnMiss: FnOnce(C::Key, QueryLookup<'_, CTX::DepKind, CTX::Query, C::Key, C::Sharded>) -> R, 

Checks if the query is already computed and in the cache. It returns the shard index and a lock guard to the shard, which will be used if the query is not in the cache and we need to compute it.