Struct rocket_file_cache::cache_builder::CacheBuilder
[−]
[src]
pub struct CacheBuilder { /* fields omitted */ }
Methods
impl CacheBuilder
[src]
fn new() -> CacheBuilder
[src]
fn size_limit_bytes<'a>(&'a mut self, size_limit_bytes: usize) -> &mut Self
[src]
Mandatory parameter, must be set. Sets the maximum number of bytes the cache can hold.
fn priority_function<'a>(
&'a mut self,
priority_function: PriorityFunction
) -> &mut Self
[src]
&'a mut self,
priority_function: PriorityFunction
) -> &mut Self
Override the default priority function used for determining if the cache should hold a file. By default a score is calculated using the square root of the size of a file, times the number of times it was accessed. Files with higher priority scores will be kept in the cache when files with lower scores are added. If there isn't room in the cache for two files, the one with the lower score will be removed / won't be added.
The priority function should be kept simple, as it is calculated on every file in the cache every time a new file is attempted to be added.