wiki.techinc.nl/tests/phpunit/unit/includes/Settings/Source
Dan Duvall a824da0f34 Support stale cached settings for failover
Require a `CacheableSource` implementation to signal whether stale
settings may be served from the cache by implementing an
`allowsStaleLoad()` method. This will be useful for sources (e.g. etcd)
that expect some degree of unavailability and failover during
unavailability is desired.

In order to support stale results, `CachedSource` sets cache items with
an indefinite TTL but uses the computed expiry timestamp in the envelope
to consider whether the item is considered expired as opposed to a true
miss where the item is malformed or not present in the cache store.  If
a `SettingsBuilderException` is thrown during the source's `load()`
method but the cache check was not a real miss, the stale cached results
are returned.

Note there is currently no pruning of cache items so it is advised that
`CacheableSource` implementations for which stale loads are allowed also
implement an immutable `getHashKey()` based on constructor arguments.

Bug: T296771
Change-Id: Ida0698a237dc0939230799700b6f54956f033d50
2022-01-21 13:31:09 -08:00
..
fixtures Settings: Introduce PhpSettingsSource for provisioning settings 2021-12-09 20:35:32 +00:00
Format
ArraySourceTest.php
FileSourceTest.php Support stale cached settings for failover 2022-01-21 13:31:09 -08:00
PhpSettingsSourceTest.php Follow up on I91cd04d14f0ff86125fc8870984dab045c2098b5 2021-12-17 19:14:35 +01:00