Nebulex adds caching to Elixir apps through a unified API and optional declarative decorators. Swap local, Redis, Memcached, or other backends without rewriting call sites.
Overview
Nebulex is an in-memory and distributed caching toolkit for Elixir modeled after Ecto-style abstractions. Application code targets Nebulex APIs instead of calling Redis, Memcached, or local caches directly, so backends can change with limited impact.
Nebulex.Cache defines standard create, read, update, and delete operations for cache entries. Nebulex.Caching adds decorator-based caching on functions, including patterns such as read-through and write-through described in the guides.
Adapters ship as separate packages; a typical setup adds Nebulex plus an adapter such as the generational local cache, optional decorator and telemetry dependencies, a cache module in the supervision tree, and configuration for sizes and garbage collection intervals.
Telemetry hooks expose stats and metrics. Nebulex Streams can broadcast cache events through Phoenix.PubSub. Documentation covers adapter selection, declarative caching, usage patterns, and writing custom adapters.
Key features
- Unified cache API across adapters
- Pluggable local and remote backends
- Declarative caching decorators
- Read-through and write-through patterns
- OTP supervision-friendly caches
- Telemetry stats and metrics
- Distributed cache topologies
- Phoenix.PubSub cache streaming
Use cases
- Application-level Elixir response caching
- Swapping Redis or Memcached via one API
- Decorator-based method memoization
- Local generational in-process caches
- Observable cache stats in production