@@ -40,7 +40,6 @@ pub const QUERY_CACHE_FILENAME: &str = ".cache.json";
4040pub const QUERY_CACHE_META_FILENAME : & str = ".cache_meta.json" ;
4141pub const CURRENT_QUERY_CACHE_VERSION : & str = "v1" ;
4242
43- // .cache.json
4443#[ derive( Default , Clone , serde:: Deserialize , serde:: Serialize , Debug , Hash , Eq , PartialEq ) ]
4544pub struct CacheMetadata {
4645 pub query : String ,
@@ -80,7 +79,7 @@ impl QueryCache {
8079 self . files . get ( & key) . cloned ( )
8180 }
8281
83- pub fn current_size ( & self ) -> u64 {
82+ pub fn used_cache_size ( & self ) -> u64 {
8483 self . current_size
8584 }
8685
@@ -137,7 +136,7 @@ impl QueryCacheMeta {
137136pub struct QueryCacheManager {
138137 filesystem : LocalFileSystem ,
139138 cache_path : PathBuf , // refers to the path passed in the env var
140- cache_capacity : u64 ,
139+ total_cache_capacity : u64 ,
141140 semaphore : Mutex < ( ) > ,
142141}
143142
@@ -151,7 +150,7 @@ impl QueryCacheManager {
151150 & format ! (
152151 "{}.{}.parquet" ,
153152 hostname_unchecked( ) ,
154- Utc :: now( ) . timestamp( ) . to_string ( )
153+ Utc :: now( ) . timestamp( )
155154 ) ,
156155 ] )
157156 }
@@ -172,7 +171,7 @@ impl QueryCacheManager {
172171 Self {
173172 filesystem : LocalFileSystem :: new ( ) ,
174173 cache_path,
175- cache_capacity : CONFIG . parseable . query_cache_size ,
174+ total_cache_capacity : CONFIG . parseable . query_cache_size ,
176175 semaphore : Mutex :: new ( ( ) ) ,
177176 }
178177 } ) ;
@@ -292,7 +291,7 @@ impl QueryCacheManager {
292291 let file_size = std:: fs:: metadata ( file_path) ?. len ( ) ;
293292 let mut cache = self . get_cache ( stream, user_id) . await ?;
294293
295- while cache. current_size + file_size > self . cache_capacity {
294+ while cache. current_size + file_size > self . total_cache_capacity {
296295 if let Some ( ( _, file_for_removal) ) = cache. files . pop_lru ( ) {
297296 let lru_file_size = fs:: metadata ( & file_for_removal) . await ?. len ( ) ;
298297 cache. current_size = cache. current_size . saturating_sub ( lru_file_size) ;
0 commit comments