Code Explainers
Code explainers tagged #cache-invalidation
php
<?php namespace App\Services;
A cached settings service in Laravel
caching
memoization
cache-invalidation
Intermediate
8 steps
python
from django.core.cache import cache from django.core.cache.utils import make_template_fragment_key from django.db.models.signals import post_save, post_delete from django.dispatch import receiver
Busting template fragment caches in Django
caching
signals
cache-invalidation
Intermediate
4 steps
javascript
import { unstable_cache, revalidateTag } from 'next/cache' import { db } from '@/lib/db' export const getDashboardStats = unstable_cache(
Caching dashboard stats in Next.js
caching
cache-invalidation
tag-based-revalidation
Intermediate
8 steps
php
<?php namespace App\Cache;
A content-hashed fragment cache in PHP
caching
content-hashing
atomic-writes
Intermediate
10 steps
ruby
module ProductsHelper def cached_product_row(product) cache [product, current_user.role] do render partial: "products/row", locals: { product: product }
Russian doll caching that busts itself in Rails
fragment-caching
cache-invalidation
associations
Intermediate
4 steps
python
from flask import Blueprint, jsonify, request, abort from flask_caching import Cache cache = Cache(config={"CACHE_TYPE": "RedisCache", "CACHE_REDIS_URL": "redis://localhost:6379/0"})
Custom cache keys for Flask endpoints
caching
redis
cache-invalidation
Intermediate
7 steps
python
from django.core.cache import cache from django.db.models import Count, Sum, Q from django.utils import timezone
Caching a Django dashboard aggregate query
caching
aggregation
conditional-queries
Intermediate
7 steps
java
@Service public class ProductCatalogService { private final ProductRepository productRepository;
How Spring cache annotations keep data fresh
caching
cache-invalidation
dependency-injection
Intermediate
7 steps