VRedis is a Redis client service written in the V programming language. It allows you to connect to a Redis database over the network, send commands, and receive responses. Please note that this project is currently under development and is not recommended for use in production projects.

Almost support all Redis commands.


Before using VRedis, you will need to install the V programming language compiler. Please visit the V language website for installation instructions. Once you have installed the V compiler, you can install VRedis using the following command:

v install xiusin.vredis


Using VRedis is straightforward. First, you need to import the vredis module:

import xiusin.vredis

Once you have successfully connected, you can send commands using the send() method and receive responses using the recv() method:

redis := vredis.new_client(host: '', port: 6379, db: 1, name: 'vclient', requirepass: '')

// or pool
mut pool := new_pool(
    dial: fn () !&Redis {
        return new_client()!
    max_active: 2
    max_conn_life_time: 1
    test_on_borrow: fn (mut conn ActiveRedisConn) ! {!

mut redis := pool.get()!
defer {
    redis.release() // You must execute this function, otherwise it will result in a memory leak.

redis.set("mykey", "hello")!
redis.hset('website', 'api', '')!
redis.zadd('sets', 1, 'v1', '2', 'v2')!

// For more usage, please refer to the test cases.


Redis Pub/Sub Subscribe to Multiple Channels Example

This example demonstrates how to use the redis.psubscribe function in Redis to subscribe to multiple channels and receive messages that match specified patterns.

redis.psubscribe(['chan*', 'order*', 'sms*'], fn (pattern string, chan string, message string) ! {
    println('pattern: ${pattern} 	chan: ${chan} -> message: ${message}')

// You must use a new instance because the above instance is blocked.
redis1.publish('chan1', 'to chan1')!
redis1.publish('order1', 'to chan1')!
redis1.publish('sms1', 'to chan1')!

Finally, when you are finished with the connection, use the close() method to close it:

// or
redis.release() // pool mode


If you are interested in VRedis and would like to contribute to it, feel free to submit issues or pull requests to our code repository on GitHub:


VRedis is licensed under the MIT License. See the LICENSE file for more information.


The Redis client is a software tool that allows you to connect to a Redis database over the network, send commands, and receive responses.

last Mar 18