pub struct DiskCache {
pub path: PathBuf,
pub capacity: CacheCapacity,
pub compression: bool,
pub shards: usize,
}Expand description
Disk cache configuration for hybrid caching
When enabled, creates a two-tier cache:
- Hot articles in memory (fast, limited capacity)
- Cold articles on disk (slower, larger capacity)
Requires the hybrid-cache feature to be enabled.
Fields§
§path: PathBufPath to disk cache directory
Directory will be created if it doesn’t exist. Recommended: Use a fast SSD or NVMe drive.
capacity: CacheCapacityMaximum disk cache size in bytes
Supports human-readable formats:
- "100gb" = 100 GB
- "10gb" = 10 GB (default)
- "1tb" = 1 TB
compression: boolEnable LZ4 compression for disk storage (default: true)
Reduces disk usage by ~60% for typical NNTP articles. Slight CPU overhead for compression/decompression.
shards: usizeNumber of shards for concurrent disk access (default: 4)
Higher values improve concurrency but use more file handles.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DiskCache
impl<'de> Deserialize<'de> for DiskCache
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for DiskCache
Auto Trait Implementations§
impl Freeze for DiskCache
impl RefUnwindSafe for DiskCache
impl Send for DiskCache
impl Sync for DiskCache
impl Unpin for DiskCache
impl UnwindSafe for DiskCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Code for Twhere
T: Serialize + DeserializeOwned,
impl<T> Code for Twhere
T: Serialize + DeserializeOwned,
Source§fn encode(&self, writer: &mut impl Write) -> Result<(), Error>
fn encode(&self, writer: &mut impl Write) -> Result<(), Error>
Encode the object into a writer. Read more
Source§fn decode(reader: &mut impl Read) -> Result<T, Error>
fn decode(reader: &mut impl Read) -> Result<T, Error>
Decode the object from a reader. Read more
Source§fn estimated_size(&self) -> usize
fn estimated_size(&self) -> usize
Estimated serialized size of the object. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more