Documentation
¶
Index ¶
- Constants
- type Cache
- type CacheOption
- type SQLiteCache
- func (c *SQLiteCache) Clear()
- func (c *SQLiteCache) Close() error
- func (c *SQLiteCache) GetActionResults(actionRef string) ([]types.DeepResult, bool)
- func (c *SQLiteCache) GetFileContent(owner, repo, path, sha string) (string, int, bool)
- func (c *SQLiteCache) GetWorkflow(path string) (*types.WorkflowFile, bool)
- func (c *SQLiteCache) SetActionResults(actionRef string, results []types.DeepResult)
- func (c *SQLiteCache) SetFileContent(owner, repo, path, sha string, content string, statusCode int)
- func (c *SQLiteCache) SetWorkflow(path string, wf *types.WorkflowFile)
Constants ¶
const DefaultTTL = 24 * time.Hour
DefaultTTL is the default time-to-live for cache entries
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // GetWorkflow retrieves a workflow file from the cache // Returns the workflow file and a boolean indicating if it was found GetWorkflow(path string) (*types.WorkflowFile, bool) // SetWorkflow stores a workflow file in the cache SetWorkflow(path string, workflow *types.WorkflowFile) // GetActionResults retrieves action results from the cache // Returns the results and a boolean indicating if they were found GetActionResults(actionRef string) ([]types.DeepResult, bool) // SetActionResults stores action results in the cache SetActionResults(actionRef string, results []types.DeepResult) // Clear empties the cache Clear() // Close releases any resources used by the cache Close() error }
Cache defines the interface for caching workflow files and action results
type CacheOption ¶
type CacheOption func(*SQLiteCache)
CacheOption is a functional option for configuring the SQLiteCache
func WithCachePath ¶
func WithCachePath(path string) CacheOption
WithCachePath sets a custom path for the cache database
func WithTTL ¶
func WithTTL(ttl time.Duration) CacheOption
WithTTL sets the time-to-live for cache entries
type SQLiteCache ¶
type SQLiteCache struct {
// contains filtered or unexported fields
}
SQLiteCache is a persistent cache implementation using SQLite
func NewSQLiteCache ¶
func NewSQLiteCache(opts ...CacheOption) (*SQLiteCache, error)
NewSQLiteCache creates a new SQLite-based cache with the specified options
func (*SQLiteCache) Close ¶
func (c *SQLiteCache) Close() error
Close closes the database connection and stops the cleanup goroutine
func (*SQLiteCache) GetActionResults ¶
func (c *SQLiteCache) GetActionResults(actionRef string) ([]types.DeepResult, bool)
GetActionResults retrieves action results from the cache
func (*SQLiteCache) GetFileContent ¶
func (c *SQLiteCache) GetFileContent(owner, repo, path, sha string) (string, int, bool)
GetFileContent retrieves file content from the cache Returns the content, status code, and whether it was found in cache
func (*SQLiteCache) GetWorkflow ¶
func (c *SQLiteCache) GetWorkflow(path string) (*types.WorkflowFile, bool)
GetWorkflow retrieves a workflow file from the cache
func (*SQLiteCache) SetActionResults ¶
func (c *SQLiteCache) SetActionResults(actionRef string, results []types.DeepResult)
SetActionResults stores action results in the cache
func (*SQLiteCache) SetFileContent ¶
func (c *SQLiteCache) SetFileContent(owner, repo, path, sha string, content string, statusCode int)
SetFileContent stores file content in the cache The statusCode parameter allows caching of 404 responses
func (*SQLiteCache) SetWorkflow ¶
func (c *SQLiteCache) SetWorkflow(path string, wf *types.WorkflowFile)
SetWorkflow stores a workflow file in the cache