Springboot Redis Module Skill logo

Springboot Redis Module Skill

Community
jiushiwon
springboot-redis-module-skill

Spring Redis 模块快速集成技能。面向已拥有 Spring Boot 项目骨架的开发者,提供 Redis 缓存、Session 存储、分布式锁、限流、消息队列等能力的快速集成。触发词:"Spring Redis"、"Spring Boot Redis"、"Redis 集成"、"redis cache"、"redis session"、"redis lock"、"redis 限流"、"redis 消息队列"。

Overview

Publisherjiushiwon
Repositorywg-skills
Skill namespringboot-redis-module-skill
Stars
123
Forks
38
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by jiushiwon on GitHub. Read the source before you install it.

Installation

Install the Springboot Redis Module Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/java/springboot-module/springboot-redis-module-skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jiushiwon/wg-skills.git /tmp/wg-skills
mkdir -p .claude/skills
cp -r /tmp/wg-skills/vibeCoding/backend/java/springboot-module/springboot-redis-module-skill .claude/skills/springboot-redis-module-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Springboot Redis Module Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Springboot Redis Module Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Springboot Redis Module Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Spring Redis Module Skill

面向已有 Spring Boot 项目的开发者,快速集成 Redis 能力。

能力清单

能力说明
缓存@Cacheable 注解缓存、缓存更新、缓存删除
SessionRedis Session 共享、Spring Session 配置
分布式锁基于 Redis 的分布式锁(Redisson)
限流基于 Redis 的接口限流
消息队列Redis Stream 消息发布/订阅
计数器分布式计数器、排行榜

触发场景

用户说"帮我加 Redis"或"集成 Redis"时触发。

依赖配置

xml
<!-- pom.xml 添加 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
    <groupId>org.redisson</groupId>
    <artifactId>redisson-spring-boot-starter</artifactId>
    <version>3.24.3</version>
</dependency>

默认方法封装

1. 缓存操作

java
// RedisConfig.java - 配置
@Configuration
@EnableCaching
public class RedisConfig {
    @Bean
    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
        // 配置序列化器
    }
}

// 使用示例
@Service
public class UserService {
    @Cacheable(value = "users", key = "#id")
    public User getUser(Long id) {
        // 首次查询数据库,之后从缓存取
    }

    @CachePut(value = "users", key = "#user.id")
    public User updateUser(User user) {
        // 更新后自动更新缓存
    }

    @CacheEvict(value = "users", key = "#id")
    public void deleteUser(Long id) {
        // 删除后自动清除缓存
    }
}

2. 分布式锁

java
@Service
public class LockService {
    @Autowired
    private RedissonClient redisson;

    public void executeWithLock(String lockKey, Runnable task) {
        RLock lock = redisson.getLock(lockKey);
        try {
            lock.lock();
            task.run();
        } finally {
            lock.unlock();
        }
    }

    // 尝试获取锁
    public boolean tryLock(String lockKey, long waitTime, long leaseTime, TimeUnit unit) {
        RLock lock = redisson.getLock(lockKey);
        return lock.tryLock(waitTime, leaseTime, unit);
    }
}

3. 限流

java
@Component
public class RateLimiter {
    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    public boolean tryAcquire(String key, int maxRequests, long windowSeconds) {
        String value = redisTemplate.opsForValue().increment(key);
        if (value == null) return false;
        
        if (value == 1) {
            redisTemplate.expire(key, windowSeconds, TimeUnit.SECONDS);
        }
        return value <= maxRequests;
    }
}

// 使用示例
@RestController
public class ApiController {
    @Autowired
    private RateLimiter rateLimiter;

    @GetMapping("/api/data")
    public ApiResponse<Data> getData() {
        String key = "ratelimit:api:data";
        if (!rateLimiter.tryAcquire(key, 100, 60)) {
            throw new BusinessException(-429, "请求过于频繁,请稍后再试");
        }
        // 业务逻辑
    }
}

4. Session 共享

yaml
# application.yml
spring:
  data:
    redis:
      host: localhost
      port: 6379
  session:
    store-type: redis
    redis:
      namespace: wg:session

5. 消息队列(Stream)

java
@Service
public class RedisStreamProducer {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    public void sendMessage(String stream, String key, Object value) {
        Map<String, String> map = new HashMap<>();
        map.put(key, JSON.toJSONString(value));
        redisTemplate.opsForStream().add(StreamRecords.newRecord().in(stream).ofMap(map));
    }
}

@Service
public class RedisStreamConsumer {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    @PostConstruct
    public void consume() {
        redisTemplate.opsForStream().read(
            Consumer.from("group1", "consumer1"),
            StreamReadOptions.empty().count(10).block(Duration.ofSeconds(2)),
            StreamOffset.create("my-stream", ReadOffset.lastConsumed())
        ).forEach(record -> {
            // 处理消息
        });
    }
}

配置模板

application.yml

yaml
spring:
  data:
    redis:
      host: ${REDIS_HOST:localhost}
      port: ${REDIS_PORT:6379}
      password: ${REDIS_PASSWORD:}
      database: ${REDIS_DATABASE:0}
      lettuce:
        pool:
          max-active: 8
          max-idle: 8
          min-idle: 2
          max-wait: -1ms

# Redisson 配置
redisson:
  address: redis://${REDIS_HOST:localhost}:${REDIS_PORT:6379}
  password: ${REDIS_PASSWORD:}
  database: ${REDIS_DATABASE:0}

不做

  • 不负责安装 Redis(用户自行安装或使用 Docker)
  • 不处理 Redis 集群配置(单节点为主)
  • 不提供数据迁移工具

Frequently asked questions

What does the Springboot Redis Module Skill AI skill do?

Spring Redis 模块快速集成技能。面向已拥有 Spring Boot 项目骨架的开发者,提供 Redis 缓存、Session 存储、分布式锁、限流、消息队列等能力的快速集成。触发词:"Spring Redis"、"Spring Boot Redis"、"Redis 集成"、"redis cache"、"redis session"、"redis lock"、"redis 限流"、"redis 消息队列"。

Why use Springboot Redis Module Skill on TypingMind?

Because you install it once and use it with any model. Springboot Redis Module Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Springboot Redis Module Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/java/springboot-module/springboot-redis-module-skill. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Springboot Redis Module Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Springboot Redis Module Skill?

As many as you like. As long as a model supports skills, you can use Springboot Redis Module Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Springboot Redis Module Skill AI skill free?

Yes. It is published on GitHub by jiushiwon under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇