From 578c7bcf77f617ce3a0c503d8c5e512033d22ffd Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sun, 17 Sep 2023 12:48:11 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix:=20improve=20the=20?= =?UTF-8?q?documentation=20for=20the=20code=20(#244)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cache/redis_cacher.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cache/redis_cacher.rs b/src/cache/redis_cacher.rs index 9e4cbab..8c74bac 100644 --- a/src/cache/redis_cacher.rs +++ b/src/cache/redis_cacher.rs @@ -29,6 +29,11 @@ impl RedisCache { /// * `redis_connection_url` - It takes the redis Connection url address. /// * `pool_size` - It takes the size of the connection pool (in other words the number of /// connections that should be stored in the pool). + /// + /// # Error + /// + /// Returns a newly constructed `RedisCache` struct on success otherwise returns a standard + /// error type. pub async fn new( redis_connection_url: &str, pool_size: u8, @@ -62,6 +67,11 @@ impl RedisCache { /// # Arguments /// /// * `url` - It takes an url as a string. + /// + /// # Error + /// + /// Returns the results as a String from the cache on success otherwise returns a `CacheError` + /// on a failure. pub async fn cached_json(&mut self, url: &str) -> Result> { self.current_connection = Default::default(); let hashed_url_string: &str = &self.hash_url(url); @@ -108,6 +118,11 @@ impl RedisCache { /// /// * `json_results` - It takes the json results string as an argument. /// * `url` - It takes the url as a String. + /// + /// # Error + /// + /// Returns an unit type if the results are cached succesfully otherwise returns a `CacheError` + /// on a failure. pub async fn cache_results( &mut self, json_results: &str,