pub struct Redis { /* private fields */ }
Expand description
Redis support for OpenDAL
Configuration
root
: Set the working directory ofOpenDAL
endpoint
: Set the network address of redis serverusername
: Set the username of Redispassword
: Set the password for authenticationdb
: Set the DB of redis
You can refer to RedisBuilder
’s docs for more information
Example
Via Builder
use anyhow::Result;
use opendal::services::Redis;
use opendal::Object;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Redis::default();
// this will build a Operator accessing Redis which runs on tcp://localhost:6379
let op: Operator = Operator::create(builder)?.finish();
let _: Object = op.object("test_file");
Ok(())
}
Implementations§
source§impl RedisBuilder
impl RedisBuilder
sourcepub fn endpoint(&mut self, endpoint: &str) -> &mut Self
pub fn endpoint(&mut self, endpoint: &str) -> &mut Self
set the network address of redis service.
currently supported schemes:
- no scheme: will be seen as “tcp”
- “tcp” or “redis”: unsecured redis connections
- “unix” or “redis+unix”: unix socket connection
sourcepub fn username(&mut self, username: &str) -> &mut Self
pub fn username(&mut self, username: &str) -> &mut Self
set the username for redis
default: no username
sourcepub fn password(&mut self, password: &str) -> &mut Self
pub fn password(&mut self, password: &str) -> &mut Self
set the password for redis
default: no password
sourcepub fn default_ttl(&mut self, ttl: Duration) -> &mut Self
pub fn default_ttl(&mut self, ttl: Duration) -> &mut Self
Set the default ttl for redis services.
If set, we will specify EX
for write operations.
Trait Implementations§
source§impl Builder for RedisBuilder
impl Builder for RedisBuilder
source§impl Clone for RedisBuilder
impl Clone for RedisBuilder
source§fn clone(&self) -> RedisBuilder
fn clone(&self) -> RedisBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RedisBuilder
impl Debug for RedisBuilder
source§impl Default for RedisBuilder
impl Default for RedisBuilder
source§fn default() -> RedisBuilder
fn default() -> RedisBuilder
Returns the “default value” for a type. Read more