Files
herolib/lib/core/redisclient/redisclient_core.v
mariobassem 91f8520229 refactor: improve redis client and publisher
- 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>
2025-01-13 16:52:21 +02:00

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
}