Rename Things, refactor some code
BREAKING: renames `binding_ip_addr` to `binding_ip` and `redis_connection_url` to `redis_url`. Renames a lot of internals as well, but they are to many to mention.
This commit is contained in:
parent
b18db5414a
commit
440216871d
17 changed files with 80 additions and 74 deletions
8
src/cache/cacher.rs
vendored
8
src/cache/cacher.rs
vendored
|
@ -32,7 +32,7 @@ impl RedisCache {
|
|||
/// # Arguments
|
||||
///
|
||||
/// * `url` - It takes an url as string.
|
||||
fn compute_url_hash(url: &str) -> String {
|
||||
fn hash_url(url: &str) -> String {
|
||||
format!("{:?}", compute(url))
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ impl RedisCache {
|
|||
/// # Arguments
|
||||
///
|
||||
/// * `url` - It takes an url as a string.
|
||||
pub fn cached_results_json(&mut self, url: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let hashed_url_string = Self::compute_url_hash(url);
|
||||
pub fn get_cached_json(&mut self, url: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let hashed_url_string = Self::hash_url(url);
|
||||
Ok(self.connection.get(hashed_url_string)?)
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ impl RedisCache {
|
|||
json_results: String,
|
||||
url: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let hashed_url_string = Self::compute_url_hash(url);
|
||||
let hashed_url_string = Self::hash_url(url);
|
||||
|
||||
// put results_json into cache
|
||||
self.connection.set(&hashed_url_string, json_results)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue