pub struct CacheEntry {
pub hash: String,
pub line_count: usize,
pub original_tokens: usize,
pub read_count: u32,
pub path: String,
pub last_access: Instant,
pub stored_mtime: Option<SystemTime>,
pub compressed_outputs: HashMap<String, String>,
pub full_content_delivered: bool,
/* private fields */
}Expand description
A cached file read: zstd-compressed content, hash, token count, and access metadata.
Fields§
§hash: String§line_count: usize§original_tokens: usize§read_count: u32§path: String§last_access: Instant§stored_mtime: Option<SystemTime>§compressed_outputs: HashMap<String, String>Mode-specific compressed outputs (e.g. “map”, “signatures”) cached to avoid re-parsing.
full_content_delivered: boolWhether full (uncompressed) content was already delivered for this hash. Prevents cache-stub loops when upgrading from compressed to full mode.
Implementations§
Source§impl CacheEntry
impl CacheEntry
Sourcepub fn new(
content: &str,
hash: String,
line_count: usize,
original_tokens: usize,
path: String,
stored_mtime: Option<SystemTime>,
) -> Self
pub fn new( content: &str, hash: String, line_count: usize, original_tokens: usize, path: String, stored_mtime: Option<SystemTime>, ) -> Self
Creates a new entry with zstd-compressed content.
Sourcepub fn set_content(&mut self, content: &str)
pub fn set_content(&mut self, content: &str)
Replaces the stored content with new zstd-compressed data.
Sourcepub fn compressed_size(&self) -> usize
pub fn compressed_size(&self) -> usize
Approximate RAM usage of the compressed content in bytes.
Source§impl CacheEntry
impl CacheEntry
Sourcepub fn eviction_score_legacy(&self, now: Instant) -> f64
pub fn eviction_score_legacy(&self, now: Instant) -> f64
Computes a legacy eviction score blending recency, frequency, and size.
pub fn get_compressed(&self, mode_key: &str) -> Option<&String>
pub fn set_compressed(&mut self, mode_key: &str, output: String)
pub fn mark_full_delivered(&mut self)
Trait Implementations§
Source§impl Clone for CacheEntry
impl Clone for CacheEntry
Source§fn clone(&self) -> CacheEntry
fn clone(&self) -> CacheEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CacheEntry
impl RefUnwindSafe for CacheEntry
impl Send for CacheEntry
impl Sync for CacheEntry
impl Unpin for CacheEntry
impl UnsafeUnpin for CacheEntry
impl UnwindSafe for CacheEntry
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> 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