Skip to main content

Module vec_cache

Module vec_cache 

Source
Expand description

VecCache maintains a mapping from K -> (V, I) pairing. K and I must be roughly u32-sized, and V must be Copy.

VecCache supports efficient concurrent put/get across the key space, with write-once semantics (i.e., a given key can only be put once). Subsequent puts will panic.

This is currently used for query caching.

Re-exportsยง

use std::fmt; ๐Ÿ”’
use std::fmt::Debug; ๐Ÿ”’
use std::fmt::Debug; ๐Ÿ”’
use std::marker::PhantomData; ๐Ÿ”’
use std::ops::Index; ๐Ÿ”’
use std::ops::IndexMut; ๐Ÿ”’
use std::sync::atomic::AtomicPtr; ๐Ÿ”’
use std::sync::atomic::AtomicU32; ๐Ÿ”’
use std::sync::atomic::AtomicUsize; ๐Ÿ”’
use std::sync::atomic::Ordering; ๐Ÿ”’
use rustc_index::Idx; ๐Ÿ”’

Structsยง

Slot ๐Ÿ”’
SlotIndex ๐Ÿ”’
This uniquely identifies a single Slot<V> entry in the buckets map, and provides accessors for either getting the value or putting a value.
VecCache
In-memory cache for queries whose keys are densely-numbered IDs (e.g CrateNum, LocalDefId), and can therefore be used as indices into a dense vector of cached values.

Enumsยง

BucketIndex ๐Ÿ”’
Index into an array of buckets.

Constantsยง

BUCKETS ๐Ÿ”’
ENTRIES_BY_BUCKET ๐Ÿ”’