Pleroma v1.1.9-10-g42f76306+dev Pleroma.Web.RichMedia.Parser View Source

Link to this section Summary

Functions

Set the rich media cache based on the expiration time of image.

Link to this section Functions

Link to this function

set_ttl_based_on_image(arg, url)

View Source

Set the rich media cache based on the expiration time of image.

Adopt behaviour Pleroma.Web.RichMedia.Parser.TTL

Example

defmodule MyModule do
  @behaviour Pleroma.Web.RichMedia.Parser.TTL
  def ttl(data, url) do
    image_url = Map.get(data, :image)
    # do some parsing in the url and get the ttl of the image
    # and return ttl is unix time
    parse_ttl_from_url(image_url)
  end
end

Define the module in the config

config :pleroma, :rich_media,
  ttl_setters: [MyModule]