Skip to content

Commit

Permalink
Merge pull request #3 from fcassin/feat/cache-invalidation
Browse files Browse the repository at this point in the history
feat: cache invalidation
  • Loading branch information
fcassin authored Jul 25, 2024
2 parents f9b50a9 + 3823c0b commit fd76b05
Show file tree
Hide file tree
Showing 6 changed files with 337 additions and 24 deletions.
169 changes: 169 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rust-version = "1.79"

[dependencies]
tracing = "0.1"
tracing-subscriber ={ version = "0.3", features = ["json", "env-filter", "fmt"] }
tracing-subscriber = { version = "0.3", features = ["json", "env-filter", "fmt"] }
clap = { version = "4.5", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
Expand All @@ -16,4 +16,5 @@ tokio = { version = "1.38", features = ["rt-multi-thread", "net", "macros"] }
reqwest = { version = "0.12", features = ["rustls-tls", "json"] }
axum = { version = "0.7" }
anyhow = "1.0"
cached ={ version = "0.52", features = ["async", "async_tokio_rt_multi_thread"] }
cached = { version = "0.52", features = ["async", "async_tokio_rt_multi_thread"] }
moka = { version = "0.12.8", features = ["future"] }
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,21 @@ mkcert localhost
local-ssl-proxy --source 8081 --target 8080 --key localhost-key.pem --cert localhost.pem
```

### Caching

By default, Terustry will cache responses from Github/Gitlab for 10 minutes. This
may result in an unwanted behaviour where a recently released version for a given
provider is not available.

The new version will become available once the cache is refreshed.

However, if you need a faster refresh timing, for example in a CI/CD pipeline, you
may request a specific cache entry to be invalidated using the following route:
`GET /terraform/providers/v1/{namespace}/{provider_name}/invalidate`

This should result in an empty 200 OK response.

For example:
```bash
curl http://localhost:8080/terraform/providers/v1/hashicorp/hashicups/invalidate
```
Loading

0 comments on commit fd76b05

Please sign in to comment.