cache

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigStorage

type ConfigStorage interface {
	// GetStorageEngine returns the storage engine name used for this cache config
	GetStorageEngine() string

	// GetStoragePath returns the full path to the storage bucket (file path or database URI)
	GetStoragePath() string

	// GetStorageVersion returns the storage version used for this cache
	GetStorageVersion() string

	// Save writes the cache config
	Save() error

	// Read loads the cache config
	Read() error
}

type JSONConfigFile

type JSONConfigFile struct {
	ConfigVersion  string `json:"config_version"`  // The schema version of this cache index file.
	StorageEngine  string `json:"storage_engine"`  // The storage engine used for this cache
	StorageVersion string `json:"storage_version"` // The storage version used for this cache
	StoragePath    string `json:"storage_path"`    // The full path to the storage bucket (file path or database URI)
	// contains filtered or unexported fields
}

JSONConfigFile is a struct that backs a llm_proxy_cache.json file, which configures the cache storage object

func NewStorageJSON

func NewStorageJSON(
	logger *slog.Logger,
	cacheDir string,
	defaultCacheConfigVer, cacheConfigFileName, currentStorageVersion, defaultStorageEngineName string,
) (*JSONConfigFile, error)

NewStorageJSON creates a new IndexFile object to help with loading/saving meta-state as a json file. This object's purpose is to help loading the other database objects by pointing to their connection settings or file paths.

cacheDir: the directory where the cache index file will be stored

func (JSONConfigFile) GetStorageEngine

func (i JSONConfigFile) GetStorageEngine() string

GetStorageEngine returns the storage engine used for this cache

func (JSONConfigFile) GetStoragePath

func (i JSONConfigFile) GetStoragePath() string

GetStoragePath returns the full path to the storage bucket (file path or database URI)

func (JSONConfigFile) GetStorageVersion

func (i JSONConfigFile) GetStorageVersion() string

GetStorageVersion returns the storage version used for this cache

func (*JSONConfigFile) Read

func (i *JSONConfigFile) Read() error

Read reads the cache config json file from disk

func (JSONConfigFile) Save

func (i JSONConfigFile) Save() error

Save writes the cache config json file to disk

type MemoryConfig

type MemoryConfig struct {
}

func NewMemoryConfig

func NewMemoryConfig() *MemoryConfig

func (*MemoryConfig) GetStorageEngine

func (m *MemoryConfig) GetStorageEngine() string

func (*MemoryConfig) GetStoragePath

func (m *MemoryConfig) GetStoragePath() string

func (*MemoryConfig) GetStorageVersion

func (m *MemoryConfig) GetStorageVersion() string

func (*MemoryConfig) Read

func (m *MemoryConfig) Read() error

func (*MemoryConfig) Save

func (m *MemoryConfig) Save() error

Jump to

Keyboard shortcuts

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