mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-21 13:38:21 -05:00
add support for caching N number of key-values pairs instead of only 3
This commit is contained in:
parent
29b76be459
commit
51214dc23a
8
src/cache/cacher.rs
vendored
8
src/cache/cacher.rs
vendored
@ -337,7 +337,11 @@ impl Cacher for RedisCache {
|
||||
urls: &[String],
|
||||
) -> Result<(), Report<CacheError>> {
|
||||
use base64::Engine;
|
||||
let mut bytes = Vec::with_capacity(3);
|
||||
|
||||
// size of search_results is expected to be equal to size of urls -> key/value pairs for cache;
|
||||
let search_results_len = search_results.len();
|
||||
|
||||
let mut bytes = Vec::with_capacity(search_results_len);
|
||||
|
||||
for result in search_results {
|
||||
let processed = self.pre_process_search_results(result)?;
|
||||
@ -348,7 +352,7 @@ impl Cacher for RedisCache {
|
||||
.iter()
|
||||
.map(|bytes_vec| base64::engine::general_purpose::STANDARD_NO_PAD.encode(bytes_vec));
|
||||
|
||||
let mut hashed_url_strings = Vec::with_capacity(3);
|
||||
let mut hashed_url_strings = Vec::with_capacity(search_results_len);
|
||||
|
||||
for url in urls {
|
||||
let hash = self.hash_url(url);
|
||||
|
Loading…
Reference in New Issue
Block a user