cache

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirName      = ".occ"
	IndexFile    = "index.json"
	MetadataFile = "metadata.json"
)

Variables

This section is empty.

Functions

func ClearCache

func ClearCache(repoPath string) error

ClearCache removes the cache directory

Types

type CacheMetadata

type CacheMetadata struct {
	// Directory-level hash for fast "anything changed?" check
	DirectoryHash string `json:"directoryHash"`

	// Per-file state for incremental updates
	FileStates map[string]FileState `json:"fileStates"`

	// Time-based metadata
	CreatedAt time.Time `json:"createdAt"`
	LastUsed  time.Time `json:"lastUsed"`

	// Index stats
	ResourceCount int `json:"resourceCount"`
}

CacheMetadata tracks cache state for invalidation

type FileState

type FileState struct {
	ModTime time.Time `json:"modTime"`
	Size    int64     `json:"size"`
	Hash    string    `json:"hash"`
}

FileState tracks the state of a single file for change detection

type PersistentIndex

type PersistentIndex struct {
	*index.Index
	// contains filtered or unexported fields
}

PersistentIndex wraps generic Index with filesystem persistence

func ForceRebuild

func ForceRebuild(repoPath string) (*PersistentIndex, error)

ForceRebuild forces a full rebuild of the index, ignoring cache

func LoadOrBuild

func LoadOrBuild(repoPath string) (*PersistentIndex, error)

LoadOrBuild loads existing index from cache or builds a new one

Jump to

Keyboard shortcuts

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