query test progress
This commit is contained in:
24
src/merger/cache.rs
Normal file
24
src/merger/cache.rs
Normal file
@ -0,0 +1,24 @@
|
||||
use dashmap::DashMap;
|
||||
|
||||
pub struct StatementCache {
|
||||
/// Maps a Cache Key (String) -> SQL String (String)
|
||||
statements: DashMap<String, String>,
|
||||
}
|
||||
|
||||
impl StatementCache {
|
||||
pub fn new(_max_capacity: u64) -> Self {
|
||||
Self {
|
||||
statements: DashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieve an existing statement name by key, or None if it missed
|
||||
pub fn get(&self, key: &str) -> Option<String> {
|
||||
self.statements.get(key).map(|v| v.clone())
|
||||
}
|
||||
|
||||
/// Insert a completely verified/compiled statement string into the cache
|
||||
pub fn insert(&self, key: String, sql: String) {
|
||||
self.statements.insert(key, sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user