Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Cache is where the cache files should go.
Cache string `env:"INFRACOST_CLI_CACHE_DIRECTORY"`
// TTL is how long cached results remain valid.
TTL time.Duration `env:"INFRACOST_CLI_CACHE_TTL" default:"1h"`
// SessionID identifies the current session (terminal, editor, CI job).
// Falls back to the parent process ID if not set.
SessionID string `env:"INFRACOST_SESSION_ID"`
}
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
func (*Config) Read ¶
Read reads a cached entry for the given absolute path, returning an error if missing or expired.
allowChanged can be set to true to return the entry even if the files have changed (so the cache is stale). This is useful for tracking changes in the results between runs, but should be set to false when inspecting results to make sure results are up-to-date.
func (*Config) ReadLatest ¶
ReadLatest reads the most recently modified cache entry, returning an error if missing or expired.
type Entry ¶
type Entry struct {
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
SourcePath string `json:"source_path"`
SessionID string `json:"session_id,omitempty"`
Data format.Output `json:"data"`
}
func (*Entry) SameSession ¶
SameSession reports whether this entry was written by the same session as the current process (same terminal, editor, or CI job).
Click to show internal directories.
Click to hide internal directories.