CDPotion.Domain.CacheStorage (cdpotion v0.1.4)

Summary

Types

Cache identifier.

Unique identifier of the Cache object.

Cached response

type of HTTP response cached

Data entry.

description not provided :(

Types

@type cache() :: %{
  cacheId: cache_id(),
  cacheName: String.t(),
  securityOrigin: String.t(),
  storageBucket: CDPotion.Domain.Storage.storage_bucket() | nil,
  storageKey: String.t()
}

Cache identifier.

@type cache_id() :: String.t()

Unique identifier of the Cache object.

Link to this type

cached_response()

@type cached_response() :: %{body: String.t()}

Cached response

Link to this type

cached_response_type()

@type cached_response_type() ::
  :basic | :cors | :default | :error | :opaqueResponse | :opaqueRedirect

type of HTTP response cached

Link to this type

data_entry()

@type data_entry() :: %{
  requestHeaders: [header()],
  requestMethod: String.t(),
  requestURL: String.t(),
  responseHeaders: [header()],
  responseStatus: integer(),
  responseStatusText: String.t(),
  responseTime: number(),
  responseType: cached_response_type()
}

Data entry.

@type header() :: %{name: String.t(), value: String.t()}

description not provided :(

Functions

Link to this function

delete_cache(cache_id)

@spec delete_cache(cache_id()) :: {String.t(), map()}

Deletes a cache.

Parameters:

  • (Required) cache_id: Id of cache for deletion.
Link to this function

delete_entry(cache_id, request)

@spec delete_entry(cache_id(), String.t()) :: {String.t(), map()}

Deletes a cache entry.

Parameters:

  • (Required) cache_id: Id of cache where the entry will be deleted.
  • (Required) request: URL spec of the request.
Link to this function

request_cache_names(security_origin \\ nil, storage_key \\ nil, storage_bucket \\ nil)

@spec request_cache_names(
  String.t(),
  String.t(),
  CDPotion.Domain.Storage.storage_bucket()
) ::
  {String.t(), map()}

Requests cache names.

Parameters:

  • (Optional) security_origin: At least and at most one of securityOrigin, storageKey, storageBucket must be specified. Security origin.
  • (Optional) storage_key: Storage key.
  • (Optional) storage_bucket: Storage bucket. If not specified, it uses the default bucket.
Link to this function

request_cached_response(cache_id, request_url, request_headers)

@spec request_cached_response(
  cache_id(),
  String.t(),
  [header()]
) :: {String.t(), map()}

Fetches cache entry.

Parameters:

  • (Required) cache_id: Id of cache that contains the entry.
  • (Required) request_url: URL spec of the request.
  • (Required) request_headers: headers of the request.
Link to this function

request_entries(cache_id, skip_count \\ nil, page_size \\ nil, path_filter \\ nil)

@spec request_entries(cache_id(), integer(), integer(), String.t()) ::
  {String.t(), map()}

Requests data from cache.

Parameters:

  • (Required) cache_id: ID of cache to get entries from.
  • (Optional) skip_count: Number of records to skip.
  • (Optional) page_size: Number of records to fetch.
  • (Optional) path_filter: If present, only return the entries containing this substring in the path