-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ZCache pkg with full redis interface implementation (#40)
* Add zcache pkg * tests * mutex tests
- Loading branch information
1 parent
e43d149
commit 9c05300
Showing
11 changed files
with
630 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package zcache | ||
|
||
import ( | ||
"github.com/go-redis/redis/v8" | ||
"time" | ||
) | ||
|
||
type Config struct { | ||
Network string | ||
Addr string | ||
Password string | ||
DB int | ||
DialTimeout time.Duration | ||
ReadTimeout time.Duration | ||
WriteTimeout time.Duration | ||
PoolSize int | ||
MinIdleConns int | ||
MaxConnAge time.Duration | ||
PoolTimeout time.Duration | ||
IdleTimeout time.Duration | ||
IdleCheckFrequency time.Duration | ||
} | ||
|
||
func (c *Config) ToRedisConfig() *redis.Options { | ||
return &redis.Options{ | ||
Network: c.Network, | ||
Addr: c.Addr, | ||
Password: c.Password, | ||
DB: c.DB, | ||
DialTimeout: c.DialTimeout, | ||
ReadTimeout: c.ReadTimeout, | ||
WriteTimeout: c.WriteTimeout, | ||
PoolSize: c.PoolSize, | ||
MinIdleConns: c.MinIdleConns, | ||
MaxConnAge: c.MaxConnAge, | ||
PoolTimeout: c.PoolTimeout, | ||
IdleTimeout: c.IdleTimeout, | ||
IdleCheckFrequency: c.IdleCheckFrequency, | ||
} | ||
} |
Oops, something went wrong.