mairie360_api_lib 0.3.4

Lib for mairie360 APIs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use deadpool_redis::redis::AsyncCommands;
use deadpool_redis::Connection;

/**
 * Check if a key exists in Redis.
 *
 * # Arguments
 * * `conn` - A mutable reference to the Redis connection.
 * * `key` - The key to check for existence.
 *
 * # Returns
 * A `Result` that is `Ok(true)` if the key exists, `Ok(false)` if it does not,
 * or an `Err` if there was an error checking the key's existence.
 */
pub async fn key_exist(conn: &mut Connection, key: &str) -> Result<bool, redis::RedisError> {
    conn.exists(key).await
}