Plug.CacheControl.Helpers (Plug.CacheControl v0.1.0)
Contains helper functions for working with cache-control header on Plug connections.
Link to this section Summary
Functions
Sets an expiration period of 100 years.
Marks the response as uncacheable.
Sets a period after which the response should be considered stale.
Marks the response as stale from the get-go.
Serializes the cache control clauses and sets them on the connection.
Link to this section Types
Link to this type
duration()
Specs
Link to this type
unit()
Specs
unit() :: :second | :seconds | :minute | :minutes | :hour | :hours | :day | :days | :week | :weeks | :year | :years
Link to this section Functions
Link to this function
cached_forever(conn, opts \\ [])
Specs
cached_forever(Plug.Conn.t(), Enum.t()) :: Plug.Conn.t()
Sets an expiration period of 100 years.
Link to this function
cached_never(conn)
Specs
cached_never(Plug.Conn.t()) :: Plug.Conn.t()
Marks the response as uncacheable.
Link to this function
expires_in(conn, duration, opts \\ [])
Specs
expires_in(Plug.Conn.t(), integer() | duration(), Enum.t()) :: Plug.Conn.t()
Sets a period after which the response should be considered stale.
Link to this function
expires_now(conn, opts \\ [])
Specs
expires_now(Plug.Conn.t(), Enum.t()) :: Plug.Conn.t()
Marks the response as stale from the get-go.
Link to this function
put_cache_control(conn, clauses)
Specs
put_cache_control(Plug.Conn.t(), [any()]) :: Plug.Conn.t()
Serializes the cache control clauses and sets them on the connection.