Skip to content

Commit

Permalink
Docs on cache busting
Browse files Browse the repository at this point in the history
  • Loading branch information
linas-deliveroo committed Aug 18, 2022
1 parent 30d335f commit be374c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,24 @@ require 'routemaster/drain/caching_busting'
$app = Routemaster::Drain::CachingBusting.new
```

### Bust Cache for a URL

If a service updates its `_links` one needs to clear caches to force URL
discovery. Run this (e.g. as a one-off in Hopper):

```ruby
url = ENV['MY_SERVICE_URL']
cache = Routemaster::Cache.new
cache.invalidate(url)
cache.bust(url)
```

Note that the URL has to match exactly. For example, `/` suffix would need to be busted separately.

The links are also stored as a class variable in the running Ruby processes.
You need to restart them, too. You can restart just the affected services or
the whole app.

## HTTP Client
The Drain is using a Faraday http client for communication between services. The client
comes with a convenient caching mechanism as a default and supports custom response materialization.
Expand Down
2 changes: 1 addition & 1 deletion routemaster-drain.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
spec.require_paths = %w(lib)

spec.add_runtime_dependency 'addressable'
spec.add_runtime_dependency 'faraday', '>= 0.9.0'
spec.add_runtime_dependency 'faraday', '>= 0.9.0', '< 1.9.0'
spec.add_runtime_dependency 'faraday_middleware'
spec.add_runtime_dependency 'typhoeus', '~> 1.1'
spec.add_runtime_dependency 'rack', '>= 1.4.5'
Expand Down

0 comments on commit be374c6

Please sign in to comment.