Trait async_graphql::dataloader::CacheStorage[][src]

pub trait CacheStorage: Send + Sync + 'static {
    type Key: Send + Sync + Clone + Eq + Hash + 'static;
    type Value: Send + Sync + Clone + 'static;
    fn get(&mut self, key: &Self::Key) -> Option<&Self::Value>;
fn insert(&mut self, key: Cow<'_, Self::Key>, val: Cow<'_, Self::Value>);
fn remove(&mut self, key: &Self::Key);
fn clear(&mut self); }
This is supported on crate feature dataloader only.

Cache storage for [DataLoader].

Associated Types

type Key: Send + Sync + Clone + Eq + Hash + 'static[src]

The key type of the record.

type Value: Send + Sync + Clone + 'static[src]

The value type of the record.

Loading content...

Required methods

fn get(&mut self, key: &Self::Key) -> Option<&Self::Value>[src]

Returns a reference to the value of the key in the cache or None if it is not present in the cache.

fn insert(&mut self, key: Cow<'_, Self::Key>, val: Cow<'_, Self::Value>)[src]

Puts a key-value pair into the cache. If the key already exists in the cache, then it updates the key’s value.

fn remove(&mut self, key: &Self::Key)[src]

Removes the value corresponding to the key from the cache.

fn clear(&mut self)[src]

Clears the cache, removing all key-value pairs.

Loading content...

Implementors

Loading content...