Ngememoize is a lightweight Angular library that makes it easy to cache expensive function calls and computed properties. By adding a simple decorator to your methods and getters, you can eliminate redundant calculations and dramatically improve your application’s performance.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/akbarsaputrait/ngememoize/llms.txt
Use this file to discover all available pages before exploring further.
Why memoization matters
In modern Angular applications, you often encounter scenarios where:- Complex calculations run repeatedly with the same inputs
- API calls are made multiple times for identical data
- Computed properties recalculate unnecessarily during change detection
- Expensive transformations slow down your UI
Key features
Decorator-based API
Add
@Ngememoize() to any method or getter for instant memoizationConfigurable caching
Control cache lifetime with
maxAge and size limits with maxSizeCustom key generation
Define your own cache key strategies for complex scenarios
Debug-friendly
Built-in logging with
debugLabel to track cache hits and missesAsync support
Works seamlessly with Promises and async/await
Tree-shakable
Lightweight design with zero unnecessary overhead
Real-world use cases
E-commerce calculations
Cache price calculations that depend on discounts, shipping, and taxes:Data transformations
Avoid re-filtering or re-sorting large datasets:API response processing
Cache expensive transformations of API data:Memoization is most effective when functions are pure (same inputs always produce the same outputs) and computationally expensive.
Performance benefits
By eliminating redundant calculations, Ngememoize can:- Reduce CPU usage - Skip expensive computations when results are cached
- Speed up rendering - Return cached values instantly during change detection
- Minimize API calls - Avoid duplicate network requests
- Improve responsiveness - Make your UI feel snappier and more fluid
Getting started
Installation
Install Ngememoize in your Angular project
Quick start
Start memoizing functions in minutes
Advanced options
Learn about all available options
Angular compatibility
Ngememoize is designed for modern Angular applications:- Angular 19+ - Full support with peer dependency requirement
- Standalone components - Works perfectly with the latest Angular patterns
- Signals-friendly - Complements Angular’s reactive primitives