 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- type ReadyGate
- func (gate *ReadyGate) Add()
- func (gate *ReadyGate) Available() int64
- func (gate *ReadyGate) Done()
- func (gate *ReadyGate) Finish(err error, total int64)
- func (gate *ReadyGate) SetAvailable(x int64)
- func (gate *ReadyGate) SetCancel(cancel context.CancelFunc)
- func (gate *ReadyGate) WaitFor(end int64) error
 
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReadyGate ¶
type ReadyGate struct {
	Cancel context.CancelFunc
	// contains filtered or unexported fields
}
    ReadyGate manages blocking cache consumers until the requested data is available.
func NewReadyGate ¶
func NewReadyGate() *ReadyGate
func (*ReadyGate) SetAvailable ¶
func (*ReadyGate) SetCancel ¶
func (gate *ReadyGate) SetCancel(cancel context.CancelFunc)
type Stats ¶
type Stats struct {
	// CapacityBytes is the maximum size of the cache in bytes. 0 means unbounded.
	//
	// This is set when the cache is created and does not change.
	CapacityBytes int64
	// CapacityBytesRemaining is the remaining size of the cache in bytes.
	//
	// This is calculated as CapacityBytes - SizeBytes.
	CapacityBytesRemaining int64
	// MaxFileCount is the maximum number of files in the cache. 0 means unbounded.
	//
	// This is set when the cache is created and does not change.
	MaxFileCount int64
	// FileCountRemaining is the remaining number of files that can be stored in the cache.
	//
	// This is calculated as MaxFileCount - FileCount.
	FileCountRemaining int64
	// FileCount represents the number of files in the cache.
	FileCount atomic.Int64
	// ReadBytes is the total number of bytes read from the cache.
	// This is incremented on each successful Read call.
	ReadBytes atomic.Int64
	// ReadCount is the total number of Read calls.
	ReadCount atomic.Int64
	// SizeBytes is the total size of all files in the cache.
	SizeBytes atomic.Int64
	// WriteBytes is the total number of bytes written to the cache.
	// This is incremented on each successful Write call.
	WriteBytes atomic.Int64
	// WriteCount is the total number of Write calls.
	WriteCount atomic.Int64
	// LoadDuration is the time taken to refresh in-memory cache statistics from disk during the most recent load.
	LoadDuration time.Duration
	// LruCount is the number of items in the LRU cache.
	LruCount int
}
    Stats maintains statistics about cache usage.
func (*Stats) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Stats. It ensures CapacityRemaining is calculated as Capacity - SizeBytes.
func (*Stats) ResetCounters ¶
func (st *Stats) ResetCounters()
ResetCounters sets "counter" type stats to zero.
It does not reset Capacity, CapacityRemaining, FileCount, or SizeBytes.
 Click to show internal directories. 
   Click to hide internal directories.