Skip to main content

FragmentCache

Struct FragmentCache 

Source
pub struct FragmentCache { /* private fields */ }
Expand description

The unified fragment cache.

Implementations§

Source§

impl FragmentCache

Source

pub fn new(config: CacheConfig) -> Self

Creates a new cache with the given configuration.

Source

pub fn config(&self) -> &CacheConfig

Returns the configuration.

Source

pub fn contains(&self, fragment_id: &str) -> bool

Checks if a fragment is cached.

Source

pub fn get_tier(&self, fragment_id: &str) -> CacheTier

Gets the tier for a fragment.

Source

pub fn access(&self, fragment_id: &str) -> CacheTier

Records a cache access, returning the tier.

Source

pub fn insert( &self, fragment_id: impl Into<String>, size: u64, tier: CacheTier, for_infernum: bool, )

Inserts a fragment into the cache.

Source

pub fn remove(&self, fragment_id: &str)

Removes a fragment from the cache.

Source

pub fn promote(&self, fragment_id: &str, to_tier: CacheTier)

Promotes a fragment to a higher tier.

Source

pub fn demote(&self, fragment_id: &str, to_tier: CacheTier)

Demotes a fragment to a lower tier.

Source

pub fn mark_shared(&self, fragment_id: &str)

Marks a fragment as used by both systems (shared).

Source

pub fn stats(&self) -> CacheStats

Returns current statistics.

Source

pub fn vram_used(&self) -> u64

Returns VRAM used.

Source

pub fn ram_used(&self) -> u64

Returns RAM used.

Source

pub fn clear(&self)

Clears all cached fragments.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.