Index of every page on this site: llms.txt
All skills
Run it yourself

Designs, audits and implements caching for a specific website or app across every layer, including HTTP/browser headers (Cache-Control, ETag, Vary), service workers, CDNs and edge (Cloudflare, Vercel, Netlify, Fastly, CloudFront, Akamai), nginx/Varnish, in-process and Redis/Valkey/Memcached caches, database and ORM caches, framework caching (Next.js use cache/ISR, Nuxt, SvelteKit, Astro, Rails, Django, Laravel, Spring, ASP.NET), CMS, REST/GraphQL APIs, mobile clients, LLM prompt and semantic caching, and CI build caches. Detects the stack, classifies every route, and writes a validated caching plan covering invalidation, stampede protection, cache security and verification. Use when the user mentions caching, stale content, purging, CDN or Redis setup, or when pages are slow, TTFB is high, or origin, database or hosting costs are too high, even if they never say "cache". Not for clearing local package-manager caches or explaining CPU caches.

  • 81 files
  • 630.9 KB
  • MIT
  • Updated 4 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/onlymoein/master-cache-skill/caching-strategy

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesframeworkselixir.md

≈633 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Elixir and Phoenix

Last reviewed: 2026-10-27 · Applies to: Phoenix, Cachex, Nebulex 3.0, ETS

When to read this

When the app is Elixir/Phoenix (mix.exs). Coverage in this skill's research was light; verify APIs against current hex docs.

How to detect

mix.exs with :phoenix, :cachex, :nebulex (+ :nebulex_local, :nebulex_redis_adapter, :decorator), :redix; mix.lock for versions.

Default recipe

# Response headers via a plug: default no-store, routes opt in
defmodule MyAppWeb.Plugs.CacheHeaders do
  import Plug.Conn
  def init(opts), do: opts
  def call(conn, _opts) do
    register_before_send(conn, fn conn ->
      case get_resp_header(conn, "cache-control") do
        [] -> put_resp_header(conn, "cache-control", "no-store")
        _ -> conn
      end
    end)
  end
end

# Public route opting in
conn
|> put_resp_header("cache-control", "no-cache")
|> put_resp_header("cdn-cache-control", "max-age=300, stale-while-revalidate=3600")
# Cachex: fetch with a fallback (one computation per key in-node)
Cachex.fetch(:app_cache, "shop:v3:product:#{id}", fn _key ->
  case Repo.get(Product, id) do
    nil -> {:ignore, nil}
    product -> {:commit, product, expire: :timer.minutes(5)}
  end
end)

Cachex.del(:app_cache, "shop:v3:product:#{id}")   # on update
# Nebulex 3 decorators (needs :decorator)
use Nebulex.Caching
@decorate cacheable(cache: MyApp.Cache, key: {Product, id}, opts: [ttl: :timer.minutes(5)])
def get_product(id), do: Repo.get(Product, id)

@decorate cache_evict(cache: MyApp.Cache, key: {Product, product.id})
def update_product(product, attrs), do: ...

Rules and gotchas

  1. ETS/Cachex caches are per node; in a cluster, invalidate across nodes (Phoenix.PubSub broadcast, Nebulex distributed/multilevel adapters) or keep TTLs short.
  2. Don't commit nil/error results as data; use {:ignore, value} or a short negative TTL.
  3. Phoenix Channels/LiveView state is live data: never HTTP-cache it; only the initial static assets and bootstrap.
  4. Nebulex 2.x vs 3.x decorator and adapter setup differ; check the version in mix.lock.
  5. Set Cache-Control on every response (plug above), including errors.

Verify

curl -s -o /dev/null -D - http://localhost:4000/products/1 | grep -iE 'cache-control|etag'
iex -S mix -e 'IO.inspect Cachex.stats(:app_cache)'

Sources

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 46a6ee6. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Activeupdated 4 weeks ago
metadata
{
  "version": "1.1.1",
  "last-reviewed": "2026-10-28"
}
Other metadata
compatibility
Live header probes need network access and user-supplied URLs; every other step runs offline with the Python 3 standard library.

README badge

README badge for onlymoein/master-cache-skill