This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cargo add serde toml | |
pub mod config { | |
use serde::{Deserialize, Serialize}; | |
use std::{fs, path::Path}; | |
#[derive(Serialize, Deserialize)] | |
pub struct Config { | |
pub version: i8, | |
pub host: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to use: | |
// | |
// var rpool = newPool() // can be global | |
// c := rpool.Get() | |
// defer c.Close() | |
// c.Do("GET", "my:data") | |
func newPool() *redis.Pool { | |
return &redis.Pool{ | |
MaxIdle: 10, // number of idle connections to keep for reusing |