redisql
MySQL to Redis caching made easy
Example Usage
CLI
Installation and Configuration:
go install github.com/DGKSK8LIFE/redisql/redisql
Create a YAML file with the following structure:
sqluser:
sqlpassword:
sqldatabase:
sqltable:
redisaddr:
redispass:
log:
Usage:
# copy to redis string
redisql copy -type=string -config=pathtofile.yml
# copy to redis list
redisql copy -type=list -config=pathtofile.yml
# copy to redis hash
redisql copy -type=hash -config=pathtofile.yml
Library
Installation:
go get github.com/DGKSK8LIFE/redisql
Usage:
package main
import (
"github.com/DGKSK8LIFE/redisql"
)
func main() {
config := redisql.Config{
SQLUser: "josh",
SQLPassword: "joshmark52",
SQLDatabase: "celebrities",
SQLTable: "celebrity",
RedisAddr: "localhost:6379",
RedisPass: "joshmark52",
Log: true,
}
err := config.CopyToString()
if err != nil {
panic(err)
}
}
Other Methods:
// copy to redis list
config.CopyToList()
// copy to redis hash
config.CopyToHash()
Current Functionality and Limitations
- Simple copying of entire MySQL tables to Redis via CLI and Go Module
- Improved logs (optional CLI output, improved formatting)
- Support for most commonly used Redis data types (strings, lists, hashes)
- Support for other SQL servers