Skip to content

rrezartprebreza/spring-boot-skills / skills/spring-boot-4/spring-data-redis

spring-data-redis

Verified

Use when implementing caching, session storage, rate limiting, or any Redis integration. Covers cache-aside pattern, key naming, TTL strategy, and serialization config.

templates/CoalescingRedisCacheManager.java

View on GitHub
package com.example.config;

import java.time.Duration;
import org.springframework.data.redis.cache.BatchStrategies;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.cache.RedisCacheWriter;
import org.springframework.data.redis.connection.RedisConnectionFactory;

/** Optional manager for expensive read-only loads, not a business-operation lock. */
public final class CoalescingRedisCacheManager {
    private CoalescingRedisCacheManager() {}

    public static RedisCacheManager create(RedisConnectionFactory factory,
            RedisCacheConfiguration configuration, Duration lockTtl) {
        if (lockTtl == null || lockTtl.isNegative() || lockTtl.isZero()) {
            throw new IllegalArgumentException("A positive lock TTL is required");
        }
        var writer = RedisCacheWriter.create(factory, settings -> settings.immediateWrites()
            .batchStrategy(BatchStrategies.scan(1000))
            .enableLocking(lock -> lock.sleepTime(Duration.ofMillis(25))
                .lockTimeout(RedisCacheWriter.TtlFunction.just(lockTtl))));
        return RedisCacheManager.builder(writer).cacheDefaults(configuration).build();
    }
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall