View Source Phoenix.LiveEditable.ViewCache (Phoenix.LiveEditable v0.0.1-alpha.2)

ViewCache

What it does:

  • starts an agent, attached to the socket
  • when the socket dies, the ViewCache is wiped out

Purpose:

  • to cache config data
  • fast and simple config storage

Rationale:

  • minimize the number of params in a HEEX tag
  • can only use string and numeric values in HEEX assigns - not lists, maps etc.

Notes:

  • depends on Phoenix.LiveEditable.Registry
  • start the application to run in iex: iex -S mix

Usage:

import Phoenix.LiveEditable.ViewCache
vc_new(name)

Link to this section Summary

Link to this section Functions

vc_new

Generate a new ViewCache populated with a ViewCache struct.

This cache is meant to be view-specific, started when the view is created, and killed when the view process is destroyed.

Link to this function

vc_putval(name, key, data)

View Source