#caching

17 snippets tagged with #caching

typescriptintermediate

In-Memory Caching with LRU Strategy

Implement LRU cache with TTL expiration, size limits, and cache-aside pattern for Node.js applications.

Best for: API response caching

#nodejs#caching
typescriptintermediate

ETag Caching Middleware

Express middleware that generates ETags and handles 304 Not Modified responses for bandwidth savings.

Best for: API caching

#express#caching
typescriptbeginner

Cached Fetch with Revalidation

Fetch external data in Server Components with time-based revalidation and error boundaries.

Best for: CMS content fetching

#fetch#caching
typescriptintermediate

Next.js ISR & On-Demand Revalidation

Configure Incremental Static Regeneration with time-based and on-demand revalidation strategies.

Best for: Caching CMS content with periodic refresh

#nextjs#isr
typescriptadvanced

Caching Strategies in Next.js

Master Next.js caching with fetch cache, unstable_cache, revalidatePath, and revalidateTag patterns.

Best for: ISR page caching

#nextjs#caching
typescriptadvanced

Cache Tags and On-Demand Revalidation

Tag cached data with identifiers and revalidate specific cache entries on demand.

Best for: CMS webhooks

#nextjs#caching
sqladvanced

Materialized View with Auto-Refresh

Create and maintain materialized views for expensive aggregate queries with concurrent refresh support.

Best for: Dashboard analytics

#materialized-view#performance
sqlintermediate

SQL Materialized View Pattern

Create and manage materialized views for caching expensive queries with refresh strategies.

Best for: Caching expensive analytics queries

#sql#materialized-view
sqlintermediate

Create and Refresh Materialized Views

Use materialized views to cache expensive query results for fast reads.

Best for: Dashboard caching

#sql#materialized-view
pythonbeginner

functools.cache and lru_cache

Memoize expensive function calls with functools.cache and lru_cache for automatic result caching.

Best for: Recursive algorithms

#caching#functools
pythonbeginner

Memoize Functions with lru_cache

Cache expensive function results automatically using functools.lru_cache.

Best for: Recursive algorithms

#python#caching
typescriptadvanced

Semantic Caching Layer for LLM Calls

Cache LLM responses by semantic similarity of prompts to reduce API costs and improve latency.

Best for: Reducing LLM API costs for repeated queries

#caching#embeddings
pythonintermediate

Batch Process Embeddings Efficiently

Process large datasets of embeddings with batching, caching, and rate limiting.

Best for: Large-scale indexing

#ai#embeddings
pythonintermediate

Cache Embeddings in Redis

Cache expensive embedding API calls in Redis to avoid redundant computation and reduce costs.

Best for: cost reduction

#redis#embeddings
pythonintermediate

Prompt Caching with OpenAI API

Reduce costs by up to 50% using OpenAI's automatic prompt caching for repeated context prefixes.

Best for: cost reduction

#openai#caching
pythonintermediate

Redis Cache-Aside Pattern in Python

Implement cache-aside (lazy loading) with Redis and Python to accelerate repeated database queries.

Best for: query caching

#redis#caching
javaintermediate

Spring Boot Caching with Redis

Add caching to Spring Boot services with @Cacheable, @CacheEvict, TTL configuration, and Redis.

Best for: Reducing database load with application-level caching

#spring-boot#caching