featurebase/storage/cache.go
reesporte 48aef0c8a4 add copyright notice back in
```bash
for file in `cat diffys`; do
   printf '%s\n%s\n' "// Copyright 2021 Molecula Corp. All rights reserved." "$(cat $file)" >$file;
done
```
2021-12-10 11:01:04 -06:00

24 lines
512 B
Go

// Copyright 2021 Molecula Corp. All rights reserved.
package storage
import (
"sync/atomic"
)
// if enableRowCache, then we must not return mmap-ed memory
// directly, but only a copy.
var enableRowcache int64 = 1
// SetRowCacheOn should only be called in NewHolder before
// all other reads.
func SetRowCacheOn(on bool) {
if on {
atomic.StoreInt64(&enableRowcache, 1)
} else {
atomic.StoreInt64(&enableRowcache, 0)
}
}
func RowCacheEnabled() bool {
return atomic.LoadInt64(&enableRowcache) == 1
}