From 13225a8ae4c122d501005a58c63a134eb0e600a6 Mon Sep 17 00:00:00 2001 From: Patrick Mylund Nielsen Date: Fri, 17 Aug 2012 11:32:24 +0200 Subject: [PATCH] Unexport the shardedcache interface and implementation until both the API and implementation are solid --- cache.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cache.go b/cache.go index 24e2bb9..bfbcfe3 100644 --- a/cache.go +++ b/cache.go @@ -13,7 +13,7 @@ import ( "time" ) -type Interface interface { +type unexportedInterface interface { Set(string, interface{}, time.Duration) Add(string, interface{}, time.Duration) error Replace(string, interface{}, time.Duration) error @@ -339,7 +339,7 @@ func New(defaultExpiration, cleanupInterval time.Duration) *Cache { return C } -type ShardedCache struct { +type unexportedShardedCache struct { *shardedCache } @@ -418,7 +418,7 @@ func (j *shardedJanitor) Run(sc *shardedCache) { } } -func stopShardedJanitor(sc *ShardedCache) { +func stopShardedJanitor(sc *unexportedShardedCache) { sc.janitor.stop <- true } @@ -445,12 +445,12 @@ func newShardedCache(n int, de time.Duration) *shardedCache { return sc } -func NewSharded(shards int, defaultExpiration, cleanupInterval time.Duration) *ShardedCache { +func unexportedNewSharded(shards int, defaultExpiration, cleanupInterval time.Duration) *unexportedShardedCache { if defaultExpiration == 0 { defaultExpiration = -1 } sc := newShardedCache(shards, defaultExpiration) - SC := &ShardedCache{sc} + SC := &unexportedShardedCache{sc} if cleanupInterval > 0 { runShardedJanitor(sc, cleanupInterval) runtime.SetFinalizer(SC, stopShardedJanitor)