Commit b6924a32 authored by harry's avatar harry

Refactor cache into util sub pkg

parent d5316c21
...@@ -35,6 +35,7 @@ import ( ...@@ -35,6 +35,7 @@ import (
etcdutil "k8s.io/kubernetes/pkg/storage/etcd/util" etcdutil "k8s.io/kubernetes/pkg/storage/etcd/util"
"k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util"
utilnet "k8s.io/kubernetes/pkg/util/net" utilnet "k8s.io/kubernetes/pkg/util/net"
utilcache "k8s.io/kubernetes/pkg/util/cache"
"k8s.io/kubernetes/pkg/watch" "k8s.io/kubernetes/pkg/watch"
etcd "github.com/coreos/etcd/client" etcd "github.com/coreos/etcd/client"
...@@ -128,7 +129,7 @@ func NewEtcdStorage(client etcd.Client, codec runtime.Codec, prefix string, quor ...@@ -128,7 +129,7 @@ func NewEtcdStorage(client etcd.Client, codec runtime.Codec, prefix string, quor
copier: api.Scheme, copier: api.Scheme,
pathPrefix: path.Join("/", prefix), pathPrefix: path.Join("/", prefix),
quorum: quorum, quorum: quorum,
cache: util.NewCache(maxEtcdCacheEntries), cache: utilcache.NewCache(maxEtcdCacheEntries),
} }
} }
...@@ -155,7 +156,7 @@ type etcdHelper struct { ...@@ -155,7 +156,7 @@ type etcdHelper struct {
// support multi-object transaction that will result in many objects with the same index. // support multi-object transaction that will result in many objects with the same index.
// Number of entries stored in the cache is controlled by maxEtcdCacheEntries constant. // Number of entries stored in the cache is controlled by maxEtcdCacheEntries constant.
// TODO: Measure how much this cache helps after the conversion code is optimized. // TODO: Measure how much this cache helps after the conversion code is optimized.
cache util.Cache cache utilcache.Cache
} }
func init() { func init() {
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package util package cache
import ( import (
"sync" "sync"
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package util package cache
import ( import (
"testing" "testing"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment