cb55009c by Pengfei Xue

remove mutex

1 parent b64e70e7
...@@ -3,7 +3,6 @@ package cache ...@@ -3,7 +3,6 @@ package cache
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
5 "errors" 5 "errors"
6 "sync"
7 "time" 6 "time"
8 7
9 "github.com/beego/redigo/redis" 8 "github.com/beego/redigo/redis"
...@@ -19,7 +18,6 @@ type RedisCache struct { ...@@ -19,7 +18,6 @@ type RedisCache struct {
19 p *redis.Pool // redis connection pool 18 p *redis.Pool // redis connection pool
20 conninfo string 19 conninfo string
21 key string 20 key string
22 mu sync.Mutex
23 } 21 }
24 22
25 // create new redis cache with default collection name. 23 // create new redis cache with default collection name.
...@@ -117,8 +115,6 @@ func (rc *RedisCache) StartAndGC(config string) error { ...@@ -117,8 +115,6 @@ func (rc *RedisCache) StartAndGC(config string) error {
117 115
118 // connect to redis. 116 // connect to redis.
119 func (rc *RedisCache) connectInit() { 117 func (rc *RedisCache) connectInit() {
120 rc.mu.Lock()
121
122 // initialize a new pool 118 // initialize a new pool
123 rc.p = &redis.Pool{ 119 rc.p = &redis.Pool{
124 MaxIdle: 3, 120 MaxIdle: 3,
...@@ -131,8 +127,6 @@ func (rc *RedisCache) connectInit() { ...@@ -131,8 +127,6 @@ func (rc *RedisCache) connectInit() {
131 return c, nil 127 return c, nil
132 }, 128 },
133 } 129 }
134
135 rc.mu.Unlock()
136 } 130 }
137 131
138 func init() { 132 func init() {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!