- Refactor the redis client to use a mutex for thread safety. - Improve error handling in context and playbook factory. - Remove the play_mdbook command and associated tests. - Add play_publisher command and tests for publishing books. - Update the repository cache to use a reference to the redis client. Co-authored-by: mahmmoud.hassanein <mahmmoud.hassanein@gmail.com>
25 lines
451 B
V
25 lines
451 B
V
module redisclient
|
|
|
|
@[params]
|
|
pub struct RedisURL {
|
|
address string = '127.0.0.1'
|
|
port int = 6379
|
|
// db int
|
|
}
|
|
|
|
pub fn get_redis_url(url string) !RedisURL {
|
|
if !url.contains(':') {
|
|
return error('url doesnt contain port')
|
|
} else {
|
|
return RedisURL{
|
|
address: url.all_before_last(':')
|
|
port: url.all_after_last(':').u16()
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn core_get(url RedisURL) !&Redis {
|
|
mut r := new('${url.address}:${url.port}')!
|
|
return r
|
|
}
|