alibaba / alibaba/jetcache

@Cached的name支持动态传参吗,比如是否支持spel和key一样

Open
#504 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

有个场景:有三张表如下。SysApi(网关表)、Person(职员表)、PersonApi(职员网关权限表)。其中SysApi的cache:name=sys_api, key=#{apiId};personApi的cache:name=person_api, key=#{authId},其中authId=personId_apiId;由于这几张表是频繁访问的每个接口调用都要判断权限,因此要做缓存。此时有个问题就是如果sysApi被删除了一条数据,无法失效personApi对应的相关数据,因为要失效PersonApi就要找到所有的相关获取personId去拼接authId然后逐一失效。所以是否考虑name也支持spel,动态创建。比如设计personApi的name=person_api_#{apiId},key=#{personId},这样要如果删除一个apiId,我只需要invalid name=person_api_#{apiId}的所有缓存即可。

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no file or test; start by locating @Cached and the current cache-name, key-expression, and invalidation entry points. Compare the existing SpEL handling for keys with the requested dynamic names, then add tests showing that deleting an apiId invalidates all matching person_api_#{apiId} entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.