Add updateConfig code to load config changes if possible for every function

This commit is contained in:
Harshavardhana
2015-07-05 22:17:56 -07:00
parent 36835befe6
commit 10b082144e
7 changed files with 138 additions and 56 deletions

View File

@@ -75,8 +75,18 @@ func NewCache(maxSize uint64) *Cache {
}
}
// SetMaxSize set a new max size
func (r *Cache) SetMaxSize(maxSize uint64) {
r.Lock()
defer r.Unlock()
r.maxSize = maxSize
return
}
// Stats get current cache statistics
func (r *Cache) Stats() Stats {
r.Lock()
defer r.Unlock()
return Stats{
Bytes: r.currentSize,
Items: r.items.Len(),