cachex-caching
MANDATORY for implementing caching in Elixir applications.
Skill by igmarin
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/igmarin-cachex-caching
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/cachex-caching
What's inside
- Skill name
cachex-caching- Description
- MANDATORY for implementing caching in Elixir applications. Invoke before adding caching layers. Configures Cachex instances, implements cache-aside and get-or-set patterns, sets TTL policies, builds cache warmers, monitors cache statistics, and sets up distributed caching across nodes. Trigger words: Cachex, caching, cache, TTL, ETS, distributed cache, cache warmer, cache warmup, cache invalidation, cache hits, cache misses, Cachex.fetch, Cachex.put, Cachex.get.
- License
- MIT
- Metadata
- version: 1.0.0 · user-invocable: true
- Instructions
- 271 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (1)
- SKILL.md
SKILL.md (first lines)
# Cachex Caching
## RULES — Follow these with no exceptions
**1.** **Set a TTL on every cached entry** — never cache indefinitely unless the data is truly immutable
**2.** **Enable `stats: true`** — required to measure cache effectiveness via `hit_rate`
**3.** **Use cache warmers for startup** — pre-populate expensive data when the application starts
**4.** **Use `Cachex.fetch/3` for get-or-set** — atomic cache-aside avoids the dogpile/race on concurrent misses
**5.** **Invalidate with `Cachex.del/2` after every mutation** — stale entries outlive the source of truth otherwise
**6.** **Handle the `{:error, reason}` tuple from every Cachex call** — fall back to the database; a cache failure must never break the request
**7.** **Bound the cache with `:limit` and an eviction policy** — unbounded caches leak memory
## End-to-End Workflow
Follow this sequence when adding caching to a feature:
1. **Add dependency** — add `{:cachex, "~> 3.6"}` to `mix.exs` and run `mix deps.get`
2. **Configure cache** — start a named Cachex instance in your application supervisor
3. **Implement get-or-set** — use `Cachex.fetch/3` for atomic cache-aside pattern
4. **Add invalidation** — call `Cachex.del/2` after mutating data
5. **Enable stats** — configure `stats: true` in cache options
6. **Add cache warmer** — for expensive data, pre-populate on startup
7. **Verify hit rate** — call `Cachex.stats/1` and confirm `hit_rate` is non-zero; see **Monitoring Cache Stats** for interpretation thresholds and remediation guidance
8. **Monitor in production** — emit telemetry events for cache operations
## Setup
```elixir
# mix.exs
defp deps do
[
{:cachex, "~> 3.6"}
]
end
```
**In your application supervisor:**
```elixir
# lib/my_app/application.ex
defmodule MyApp.Application do
use Application
@impl true
def start(_type, _args) do
children = [
# Basic cache with 1000 entry limit
{Cachex, name: :my_cache, limit: 1000},
# Cache with stats enabled for monitoring
{Cachex, name: :stats_cache, limit: 5000, stats: true},
# Cache with TTL, LRW eviction policy, stats, and hooks
{Cachex,
name: :ttl_cache,
limit: 10_000,
ttl: :timer.minutes(10),
policy: Cachex.Policy.LRW,
stats: true,
hooks: [
%Cachex.Hook{module: MyApp.CacheLogger}
]}
]
Supervisor.start_link(children, strategy: :one_for_one)
end
end
```
## Basic Operations
```elixir
case Cachex.get(:my_cache, "user:123") do
{:ok, nil} -> :miss
{:ok, value} -> {:hit, value}
end
# put with explicit TTL (overrides cache-level default)
Cachex.put(:my_cache, "session:abc", data, ttl: :timer.minutes(30))
Cachex.del(:my_cache, "user:123")
Cachex.clear(:my_cache)
```
## Get-or-Set Pattern
```elixir
# Cachex.fetch/3 — atomic cache-aside, avoids race conditions
{status, value} =
Cachex.fetch(:my_cache, "user:123", fn key ->
user = MyApp.Accounts.get_user(123)
{:commit, user, ttl: :timer.minutes(5)}
end)
case status do
:ok -> IO.puts("Cache hit")
:commit -> IO.puts("Cache miss - computed and cached")
end
```
## Cache Warmers
```elixir
defmodule MyApp.CacheWarmer do
use Cachex.Warmer
def execute(state) do
users = MyApp.Accounts.list_active_users()
actions =
Enum.map(users, fn user ->
{:put, "user:#{user.id}", user, ttl: :timer.hours(1)}From igmarin/elixir-phoenix-skills, MIT.
More from igmarin/elixir-phoenix-skills
- 0.585score
phoenix-authorization-patterns
igmarin
Handles all authorization and access control work in Phoenix and LiveView applications.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
ash-framework
igmarin
MANDATORY when considering, adopting, or working with Ash Framework for Elixir applications.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
benchee-profiling
igmarin
MANDATORY when profiling and benchmarking Elixir code, or before optimizing performance-critical code.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
broadway-data-pipelines
igmarin
MANDATORY when building data processing pipelines or consuming message queues.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
mix-tasks-generators
igmarin
MANDATORY when creating custom Mix tasks or using Phoenix generators.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
oban-essentials
igmarin
MANDATORY for ALL Oban work.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
otp-essentials
igmarin
MANDATORY for ALL OTP work.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
phoenix-authentication
igmarin
Use when adding or changing Phoenix authentication, phx.gen.auth integration, LiveView session identity, or migration between current_user and Phoenix 1.8…
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
apply-phoenix-controller-conventions
igmarin
Use when writing new controller code in Phoenix applications.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
deployment-gotchas
igmarin
MANDATORY for deployment and release configuration.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
ecto-changeset-patterns
igmarin
MANDATORY for ALL changeset work beyond basic CRUD.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
ecto-nested-associations
igmarin
MANDATORY for ALL nested association and multi-table work.
SkillAFreshness: A★ 5Claude Code +9
Signals
- Stars
- 5
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Sep 28, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- MIT
- Repository
- github.com/igmarin/elixir-phoenix-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from igmarin
- 0.619score
implement-hotwire
igmarin
Use when adding Turbo Frames, Turbo Streams, or Stimulus controllers.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
optimize-performance
igmarin
Use when investigating N+1s, slow queries, caching, or query plans in Rails.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
extract-engine
igmarin
Use when extracting a host-app feature into a Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
implement-authorization
igmarin
Use when adding or reviewing Rails authorization with Pundit, CanCanCan, or policy objects.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
create-engine
igmarin
Use when scaffolding a new Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
seed-database
igmarin
Use when choosing seeds, fixtures, or factories for Rails dev/test data.
SkillAFreshness: A★ 28Claude Code +9
Cite this page
cachex-caching skill. Agent Mart. https://agentmart.dev/skills/igmarin-cachex-caching (last updated 2026-10-24)