Skip to main content

Cache

Trait Cache 

Source
pub trait Cache: Send + Sync {
    // Required methods
    fn get_lookups(
        &self,
        provider: &ProviderId,
        ids: &[WorkId],
    ) -> Result<Vec<Option<Entry<Option<SourceRecord>>>>, StoreError>;
    fn put_lookups(
        &self,
        provider: &ProviderId,
        answers: &[(&WorkId, Option<&SourceRecord>)],
        at: Timestamp,
    ) -> Result<(), StoreError>;
    fn get_search(
        &self,
        provider: &ProviderId,
        query: &SearchQuery,
    ) -> Result<Option<Entry<Page>>, StoreError>;
    fn put_search(
        &self,
        provider: &ProviderId,
        query: &SearchQuery,
        page: &Page,
        at: Timestamp,
    ) -> Result<(), StoreError>;
}
Expand description

What the engine needs from a cache; it depends on this, not on SQLite.

Required Methods§

Source

fn get_lookups( &self, provider: &ProviderId, ids: &[WorkId], ) -> Result<Vec<Option<Entry<Option<SourceRecord>>>>, StoreError>

The cached answer for each of ids at provider, in order; None where nothing is cached.

Source

fn put_lookups( &self, provider: &ProviderId, answers: &[(&WorkId, Option<&SourceRecord>)], at: Timestamp, ) -> Result<(), StoreError>

Stores provider’s answers in one transaction. A found record is also reachable by every identifier it asserts.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§