stats

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package stats extracts Drupal 8 cache information from a Redis database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinStats

type BinStats struct {
	Keys uint32 // Redis only supports 2^32 keys anyway.
	Size int64
}

BinStats holds Stats for a single Drupal cache bin.

type CacheStats

type CacheStats struct {
	//TODO #1 implement these fields.
	//memoryUsed    uint64
	//memoryPeak    uint64
	//drupalVersion string
	//TODO #2
	//drupalPrefix  string
	TotalKeys uint32 // Redis hardcoded limit.
	Stats     map[string]BinStats
}

CacheStats represents the discovered information about Drupal cache data held in a Redis database.

func (CacheStats) ItemCountLength

func (cs CacheStats) ItemCountLength() uint

ItemCountLength returns the length in runes of the total number of keys.

Since this is the sum of all bins, it is at least as large as any per-bin info.

func (CacheStats) MaxBinNameLength

func (cs CacheStats) MaxBinNameLength() int

MaxBinNameLength returns the length in runes of the longest bin name.

func (*CacheStats) Scan

func (cs *CacheStats) Scan(c redis.Conn, maxPasses uint32, w io.Writer) error

Scan examines the active database for keys matching the Drupal cache bin format.

  • c is the established connection to Redis on which to perform the Scan.
  • maxPasses allows limiting the number of Redis SCAN steps. Use 0 for no limit.
  • writer is a logging output (think os.Stderr), not the main output.

func (CacheStats) TotalSize

func (cs CacheStats) TotalSize() int64

TotalSize returns the total ize used by the cache.

By Redis MEMORY USAGE description, this includes both keys and data.

func (CacheStats) TotalSizeLength

func (cs CacheStats) TotalSizeLength() int

TotalSizeLength returns the length in runes of the cache size, expressed in bytes.

Since this is the sum of all bins, it is at least as large as any per-bin info.

Directories

Path Synopsis
Package progress implements a simple progress bar.
Package progress implements a simple progress bar.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL