FeatureRequest: provide PinnedSlice or something to avoid memmove
- Lingua principale
- Go
- Stelle
- 8.2k
- Fork
- 614
- Merge medio
- 5g 12h
- PR unite (30g)
- 1
Descrizione
For now, every time we get an entry from bigcache when cache hit, bigcache will allocate a new
byte slice and copy cache content into it internally. I propose to provide a way to let users to manage the lifetime of the entry they got, to avoid internal memory copy.
```
type PinnedSlice struct {...}
func (this PinnedSlice) Copy() PinnedSlice {...}
func (this PinnedSlice) Release() {...}
func (c *BigCache) GetPinnedSlice(key string) (PinnedSlice, error)
```
Internally, we can add a reference count in the header of wrapped entry, just like timestamps. Once we want to evict an entry, we need to check whether its reference count is zero, if not, we should jump across it and check next entry.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.