Refactor cache into util sub pkg

This commit is contained in:
harry 2016-03-09 14:43:30 +08:00
parent d5316c21ef
commit b6924a322a
3 changed files with 5 additions and 4 deletions

View File

@ -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
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 {
// 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() {

View File

@ -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"

View File

@ -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"