Struct concread::arcache::ARCacheReadTxn [−][src]
pub struct ARCacheReadTxn<'a, K, V> where
K: Hash + Eq + Ord + Clone + Debug + Sync + Send + 'static,
V: Clone + Debug + Sync + Send + 'static, { /* fields omitted */ }
Expand description
An active read transaction over the cache. The data is this cache is guaranteed to be valid at the point in time the read is created. You may include items during a cache miss via the “insert” function.
Implementations
Attempt to retieve a k-v pair from the cache. If it is present in the main cache OR
the thread local cache, a Some
is returned, else you will recieve a None
. On a
None
, you must then consult the external data source that this structure is acting
as a cache for.
Determine if this cache contains the following key.
Insert an item to the cache, with an associated weight/size factor. See also [insert]
Add a value to the cache. This may be because you have had a cache miss and now wish to include in the thread local storage.
Note that is invalid to insert an item who’s key already exists in this thread local cache, and this is asserted IE will panic if you attempt this. It is also invalid for you to insert a value that does not match the source-of-truth state, IE inserting a different value than another thread may percieve. This is a read thread, so you should only be adding values that are relevant to this read transaction and this point in time. If you do not heed this warning, you may alter the fabric of time and space and have some interesting distortions in your data over time.