Skip to main content

picturium_libvips/
cache.rs

1#[derive(Debug)]
2pub struct Cache {
3    pub(crate) capacity: i32,
4    pub(crate) memory_capacity: usize,
5    pub(crate) files_capacity: i32
6}
7
8impl Default for Cache {
9    fn default() -> Self {
10        Cache {
11            capacity: 100, // operations
12            memory_capacity: 100 * 1024 * 1024, // 100 MB
13            files_capacity: 100 // files
14        }
15    }
16}
17
18impl Cache {
19    pub fn new(capacity: i32, memory_capacity: usize, files_capacity: i32) -> Self {
20        Cache {
21            capacity,
22            memory_capacity,
23            files_capacity
24        }
25    }
26    
27    pub fn disabled() -> Self {
28        Cache::new(0, 0, 0)
29    }
30}