Documentation
¶
Index ¶
- Variables
- func CloseCaches() error
- func CopyFiles(currentPath string, targetPath string) error
- func ExpandEnv(s string) string
- func GetHeyFrameCliCacheDir() string
- func GetInstalledNodeVersion(ctx context.Context) (string, error)
- func GetInstalledPHPVersion(ctx context.Context) (string, error)
- func IsNodeVersionAtLeast(ctx context.Context, requiredVersion string) (bool, error)
- func IsPHPVersionAtLeast(ctx context.Context, requiredVersion string) (bool, error)
- type Cache
- type CacheFactory
- type DefaultCacheFactory
- type DiskCache
- func (c *DiskCache) Close() error
- func (c *DiskCache) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (c *DiskCache) GetFilePath(ctx context.Context, key string) (string, error)
- func (c *DiskCache) GetFolderCachePath(ctx context.Context, key string) (string, error)
- func (c *DiskCache) RestoreFolderCache(ctx context.Context, key string, targetPath string) error
- func (c *DiskCache) Set(ctx context.Context, key string, data io.Reader) error
- func (c *DiskCache) StoreFolderCache(ctx context.Context, key string, folderPath string) error
- type GitHubActionsCache
- func (c *GitHubActionsCache) Close() error
- func (c *GitHubActionsCache) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (c *GitHubActionsCache) GetFilePath(ctx context.Context, key string) (string, error)
- func (c *GitHubActionsCache) GetFolderCachePath(ctx context.Context, key string) (string, error)
- func (c *GitHubActionsCache) RestoreFolderCache(ctx context.Context, key string, targetPath string) error
- func (c *GitHubActionsCache) Set(ctx context.Context, key string, data io.Reader) error
- func (c *GitHubActionsCache) StoreFolderCache(ctx context.Context, key string, folderPath string) error
Constants ¶
This section is empty.
Variables ¶
var ErrCacheNotFound = errors.New("cache item not found")
ErrCacheNotFound is returned when a cache item cannot be found
Functions ¶
func CloseCaches ¶
func CloseCaches() error
CloseCaches closes all tracked caches collecting the first error if multiple occur. It is safe to call multiple times; subsequent calls will no-op as the slice is cleared.
func GetHeyFrameCliCacheDir ¶
func GetHeyFrameCliCacheDir() string
GetHeyFrameCliCacheDir returns the base cache directory for heyframe-c
func GetInstalledNodeVersion ¶
GetInstalledNodeVersion checks the installed Node.js version on the system.
func GetInstalledPHPVersion ¶
GetInstalledPHPVersion checks the installed PHP version on the system.
func IsNodeVersionAtLeast ¶
IsNodeVersionAtLeast checks if the installed Node.js version meets the minimum required version.
Types ¶
type Cache ¶
type Cache interface {
// Get retrieves a cached item by key. Returns ErrCacheNotFound if not found.
Get(ctx context.Context, key string) (io.ReadCloser, error)
// Set stores an item in the cache with the given key
Set(ctx context.Context, key string, data io.Reader) error
// GetFilePath returns a file path for direct access to the cached item.
// For local caches, this returns the actual file path.
// For remote caches, this downloads the item to a temp file and returns that path.
// Returns ErrCacheNotFound if the item doesn't exist.
GetFilePath(ctx context.Context, key string) (string, error)
// StoreFolderCache stores an entire folder structure in the cache with the given key.
// The folderPath should be the root directory to cache.
StoreFolderCache(ctx context.Context, key string, folderPath string) error
// GetFolderCachePath returns a folder path for direct access to the cached folder.
// For local caches, this returns the actual folder path.
// For remote caches, this downloads and extracts the folder to a temp directory.
// Returns ErrCacheNotFound if the folder doesn't exist.
GetFolderCachePath(ctx context.Context, key string) (string, error)
// RestoreFolderCache extracts/copies a cached folder to the specified target directory.
// This is useful when you want to restore cached content to a specific location.
// Returns ErrCacheNotFound if the cached folder doesn't exist.
RestoreFolderCache(ctx context.Context, key string, targetPath string) error
// Close cleans up any temporary files or resources held by the cache
Close() error
}
Cache provides a unified interface for caching operations
func GetCacheWithPrefix ¶
GetCacheWithPrefix returns a cache instance with a custom prefix using the factory
func GetDefaultCache ¶
func GetDefaultCache() Cache
GetDefaultCache returns a default cache instance using the factory
type CacheFactory ¶
type CacheFactory interface {
CreateCache() Cache
}
CacheFactory creates cache instances based on the environment
type DefaultCacheFactory ¶
type DefaultCacheFactory struct{}
DefaultCacheFactory implements CacheFactory
func NewCacheFactory ¶
func NewCacheFactory() *DefaultCacheFactory
NewCacheFactory creates a new cache factory
func (*DefaultCacheFactory) CreateCache ¶
func (f *DefaultCacheFactory) CreateCache() Cache
CreateCache creates a cache instance based on the environment
func (*DefaultCacheFactory) CreateCacheWithPrefix ¶
func (f *DefaultCacheFactory) CreateCacheWithPrefix(prefix string) Cache
CreateCacheWithPrefix creates a cache instance with a custom prefix/directory
type DiskCache ¶
type DiskCache struct {
// contains filtered or unexported fields
}
DiskCache implements Cache interface using local filesystem
func NewDiskCache ¶
NewDiskCache creates a new disk-based cache
func (*DiskCache) GetFilePath ¶
GetFilePath returns the file path for direct access to the cached item
func (*DiskCache) GetFolderCachePath ¶
GetFolderCachePath returns the folder path for direct access to the cached folder
func (*DiskCache) RestoreFolderCache ¶
RestoreFolderCache copies a cached folder to the specified target directory
type GitHubActionsCache ¶
type GitHubActionsCache struct {
// contains filtered or unexported fields
}
GitHubActionsCache implements Cache interface using GitHub Actions cache
func NewGitHubActionsCache ¶
func NewGitHubActionsCache(prefix string) (*GitHubActionsCache, error)
NewGitHubActionsCache creates a new GitHub Actions cache
func (*GitHubActionsCache) Close ¶
func (c *GitHubActionsCache) Close() error
Close cleans up all temporary files created by GetFilePath
func (*GitHubActionsCache) Get ¶
func (c *GitHubActionsCache) Get(ctx context.Context, key string) (io.ReadCloser, error)
Get retrieves a cached item by key
func (*GitHubActionsCache) GetFilePath ¶
GetFilePath downloads the cache item to a temporary file and returns the file path
func (*GitHubActionsCache) GetFolderCachePath ¶
GetFolderCachePath downloads and extracts the cached folder to a temporary directory
func (*GitHubActionsCache) RestoreFolderCache ¶
func (c *GitHubActionsCache) RestoreFolderCache(ctx context.Context, key string, targetPath string) error
RestoreFolderCache downloads and extracts a cached folder to the specified target directory
func (*GitHubActionsCache) StoreFolderCache ¶
func (c *GitHubActionsCache) StoreFolderCache(ctx context.Context, key string, folderPath string) error
StoreFolderCache stores an entire folder structure in the cache