harp_apps.http_cache.settings¶
- class HttpCacheSettings[source]¶
Bases:
ApplicationSettingsMixin,ConfigurableCreate a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- policy: Service¶
Cache policy to use for determining what is cacheable. hishel 1.0 uses SpecificationPolicy with CacheOptions. Default configuration (defined in services.yml):
shared: True (shared cache mode)
supported_methods: [“GET”, “HEAD”] (only cache GET and HEAD requests)
allow_stale: False (do not serve stale responses)
- To customize cache behavior, override the entire policy service:
- http_cache:
- policy:
type: my_custom_policy.CustomPolicy
- storage: Service¶
Cache storage implementation, a.k.a how to store and retrieve cache data.
allow_heuristicsopts into RFC 9111 §4.2.2, which lets a cache invent a freshness lifetime fromLast-Modifiedfor responses the origin never declared cacheable. HARP keeps it off, as it did before hishel 1.x: the cache key is built from the request URL alone, so guessing would let responses to differently authenticated callers collide.