pub struct CacheLinks<L> { /* private fields */ }Expand description
links kept as CacheOptions tell; see the top of this module. Every write
has to go through it for it to know which links exist.
Implementations§
Source§impl<L: NamedTypeLinks> CacheLinks<L>
impl<L: NamedTypeLinks> CacheLinks<L>
Sourcepub fn new(links: L, options: CacheOptions) -> Self
pub fn new(links: L, options: CacheOptions) -> Self
links on the system clock. A step back in that clock delays what comes due.
wasm32-unknown-unknown has no system clock: there, use Self::with_clock.
Sourcepub fn with_clock(
links: L,
options: CacheOptions,
clock: impl FnMut() -> u64 + Send + 'static,
) -> Self
pub fn with_clock( links: L, options: CacheOptions, clock: impl FnMut() -> u64 + Send + 'static, ) -> Self
links on a clock of milliseconds. The links already there are the least
recently used, in the order of their addresses, and have no deadline.
Sourcepub fn into_inner(self) -> L
pub fn into_inner(self) -> L
The store below, without the cache.
Sourcepub fn purge_expired(&mut self) -> Result<usize>
pub fn purge_expired(&mut self) -> Result<usize>
Deletes what is due now, and how many links that deleted, cascades included.
Sourcepub fn expire(&mut self, id: u32, milliseconds: u64) -> Result<bool>
pub fn expire(&mut self, id: u32, milliseconds: u64) -> Result<bool>
Gives id a deadline in place of any it had; false when there is no such
link. A time of zero deletes it now, as Redis EXPIRE does.
Trait Implementations§
Source§impl<L: NamedTypeLinks> NamedTypeLinks for CacheLinks<L>
impl<L: NamedTypeLinks> NamedTypeLinks for CacheLinks<L>
Source§fn create(&mut self, source: u32, target: u32) -> u32
fn create(&mut self, source: u32, target: u32) -> u32
Panics when the cache is full; use try_create.
Source§fn ensure_created(&mut self, id: u32) -> u32
fn ensure_created(&mut self, id: u32) -> u32
Panics when the cache is full; use
try_ensure_created.
Source§fn next_created_addresses(&mut self, count: usize) -> Result<Vec<u32>>
fn next_created_addresses(&mut self, count: usize) -> Result<Vec<u32>>
Asked of the store below: asking by creating here could evict.
Source§fn get_or_create(&mut self, source: u32, target: u32) -> u32
fn get_or_create(&mut self, source: u32, target: u32) -> u32
Panics when the cache is full; use
try_get_or_create.
Source§fn query_limits(&self) -> Option<QueryLimits>
fn query_limits(&self) -> Option<QueryLimits>
Source§fn try_create(&mut self, source: u32, target: u32) -> Result<u32>
fn try_create(&mut self, source: u32, target: u32) -> Result<u32>
fn try_ensure_created(&mut self, id: u32) -> Result<u32>
Source§fn reference_exists(&mut self, id: u32) -> bool
fn reference_exists(&mut self, id: u32) -> bool
id names a link that exists. Read moreSource§fn claims(&mut self, id: u32) -> Option<bool>
fn claims(&mut self, id: u32) -> Option<bool>
id is an address of this store, so a link created there
(Self::ensure_created, the undo of a delete) belongs in it; None
for a plain store, which has no addresses of its own. Read morefn get_link(&mut self, id: u32) -> Option<Link>
fn exists(&mut self, id: u32) -> bool
Source§fn update_observed(
&mut self,
id: u32,
source: u32,
target: u32,
observer: ChangeObserver<'_>,
) -> Result<Link>
fn update_observed( &mut self, id: u32, source: u32, target: u32, observer: ChangeObserver<'_>, ) -> Result<Link>
Self::update, reporting every change the update caused. Read moreSource§fn delete_observed(
&mut self,
id: u32,
observer: ChangeObserver<'_>,
) -> Result<Link>
fn delete_observed( &mut self, id: u32, observer: ChangeObserver<'_>, ) -> Result<Link>
Self::delete, reporting every change the deletion caused. Read morefn all_links(&mut self) -> Vec<Link> ⓘ
Source§fn query_links(
&mut self,
index: Option<u32>,
source: Option<u32>,
target: Option<u32>,
) -> Vec<Link> ⓘ
fn query_links( &mut self, index: Option<u32>, source: Option<u32>, target: Option<u32>, ) -> Vec<Link> ⓘ
None matches any value, in
the order of their addresses. Read more