harp_apps.http_cache.settings

Inheritance diagram of harp_apps.http_cache.settings

class HttpCacheSettings[source]

Bases: ApplicationSettingsMixin, Configurable

Create 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_client:
cache:
policy:

type: my_custom_policy.CustomPolicy

storage: Service
transport: Service

Cache transport to use for the client. This is usually a hishel._async_httpx.AsyncCacheTransport (or subclass) instance.