mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
clean up nopCache
This commit is contained in:
parent
65700f9604
commit
712404b4ec
2 changed files with 12 additions and 20 deletions
30
cache.go
30
cache.go
|
|
@ -493,28 +493,20 @@ type nopCache struct {
|
|||
}
|
||||
|
||||
// Ensure NopCache implements Cache.
|
||||
var _ cache = &nopCache{}
|
||||
|
||||
// newNopCache returns a new instance of NopCache.
|
||||
func newNopCache() *nopCache {
|
||||
return &nopCache{
|
||||
stats: NopStatsClient,
|
||||
}
|
||||
var globalNopCache cache = nopCache{
|
||||
stats: NopStatsClient,
|
||||
}
|
||||
|
||||
func (c *nopCache) Add(id uint64, n uint64) {}
|
||||
func (c *nopCache) BulkAdd(id uint64, n uint64) {}
|
||||
func (c *nopCache) Get(id uint64) uint64 { return 0 }
|
||||
func (c *nopCache) IDs() []uint64 { return make([]uint64, 0) }
|
||||
func (c nopCache) Add(uint64, uint64) {}
|
||||
func (c nopCache) BulkAdd(uint64, uint64) {}
|
||||
func (c nopCache) Get(uint64) uint64 { return 0 }
|
||||
func (c nopCache) IDs() []uint64 { return []uint64{} }
|
||||
|
||||
func (c *nopCache) Invalidate() {}
|
||||
func (c *nopCache) Len() int { return 0 }
|
||||
func (c *nopCache) Recalculate() {
|
||||
}
|
||||
func (c *nopCache) SetStats(s StatsClient) {
|
||||
c.stats = s
|
||||
}
|
||||
func (c nopCache) Invalidate() {}
|
||||
func (c nopCache) Len() int { return 0 }
|
||||
func (c nopCache) Recalculate() {}
|
||||
func (c nopCache) SetStats(StatsClient) {}
|
||||
|
||||
func (c *nopCache) Top() []bitmapPair {
|
||||
func (c nopCache) Top() []bitmapPair {
|
||||
return []bitmapPair{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ func (f *fragment) openCache() error {
|
|||
case CacheTypeLRU:
|
||||
f.cache = newLRUCache(f.CacheSize)
|
||||
case CacheTypeNone:
|
||||
f.cache = newNopCache()
|
||||
f.cache = globalNopCache
|
||||
return nil
|
||||
default:
|
||||
return ErrInvalidCacheType
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue