Skip to content

feat: Make cache TTL configurable - #40

Merged
aaronlehmann merged 1 commit into
coder:mainfrom
aaronlehmann:configurable-cache-ttl
Jul 25, 2023
Merged

aaronlehmann merged 1 commit into
coder:mainfrom
aaronlehmann:configurable-cache-ttl

Conversation

@aaronlehmann

Copy link
Copy Markdown
Contributor

Add a CACHE_TTL_DAYS env var to control layer cache TTL.

Also, fix int handling in OptionsFromEnv (which is also needed for GIT_CLONE_DEPTH).

Comment thread envbuilder.go

// CacheTTLDays is the number of days to use cached layers before
// expiring them. Defaults to 7 days.
CacheTTLDays int `env:"CACHE_TTL_DAYS"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this a time.Duration instead? Go can parse pretty nice strings like "7d" or "12hr".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about that, but since days aren't supported in the format, it's an awkward way to specify long time periods. Okay with me if you prefer that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, you're right I forgot. I think days is fine in that case. It's weird that someone would want to cache for hours anyways.

@kylecarbs

Copy link
Copy Markdown
Member

@aaronlehmann could you resolve the new conflicts on your branch? Then feel free to auto-merge!

Add a CACHE_TTL_DAYS env var to control layer cache TTL.

Also, fix int handling in OptionsFromEnv (which is also needed for
GIT_CLONE_DEPTH).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants