Skip to content

Commit 4a402cc

Browse files
committed
✨ Introducing new features. up mica-auto 3.0.0 spring-boot 3.0.0
1 parent 0c43424 commit 4a402cc

File tree

7 files changed

+75
-36
lines changed

7 files changed

+75
-36
lines changed

Diff for: .github/workflows/maven.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will build a Java project with Maven
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: idempotent-spring-boot-starter
4+
name: oss-spring-boot-starter
55

66
on:
77
push:
@@ -13,15 +13,15 @@ jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up JDK 11
18-
uses: actions/setup-java@v2
19-
with:
20-
java-version: '11'
21-
distribution: 'adopt'
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v2
19+
with:
20+
java-version: '17'
21+
distribution: 'adopt'
2222

23-
- name: mvn clean install
24-
run: mvn clean install -Dmaven.test.skip=true
23+
- name: mvn clean install
24+
run: mvn clean install
2525

26-
- name: mvn spring-javaformat:validate
27-
run: mvn spring-javaformat:validate
26+
- name: mvn spring-javaformat:validate
27+
run: mvn spring-javaformat:validate

Diff for: .github/workflows/oss-deploy.yml renamed to .github/workflows/oss-release-deploy.yml

+5-13
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,22 @@ on:
66
- '*'
77

88
jobs:
9-
oss-deploy:
9+
oss-release-deploy:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v3
14-
- name: Set up JDK 11
14+
- name: Set up JDK 17
1515
uses: actions/setup-java@v2
1616
with:
17-
java-version: '11'
17+
java-version: '17'
1818
distribution: 'adopt'
1919
cache: maven
2020

21-
# - name: Build with Maven
22-
# run: mvn -B package --file pom.xml
23-
24-
# - name: Publish to GitHub Packages Apache Maven
25-
# run: mvn deploy
26-
# env:
27-
# GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
28-
2921
- name: Setup Maven Central
3022
uses: actions/setup-java@v3
3123
with: # overwrite settings.xml
32-
java-version: '11'
24+
java-version: '17'
3325
distribution: 'adopt'
3426
server-id: sonatype
3527
server-username: OSSRH_USERNAME
@@ -38,7 +30,7 @@ jobs:
3830
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3931

4032
- name: Publish to Maven Central
41-
run: mvn clean deploy -Dmaven.test.skip=true -P 'release'
33+
run: mvn clean deploy -P release -Dmaven.test.skip=true
4234
env:
4335
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
4436
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}

Diff for: .github/workflows/oss-snapshot-deploy.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: publish maven package
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
oss-snapshot-deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: Set up JDK 17
14+
uses: actions/setup-java@v2
15+
with:
16+
java-version: '17'
17+
distribution: 'adopt'
18+
cache: maven
19+
20+
- name: Setup Maven Central
21+
uses: actions/setup-java@v3
22+
with: # overwrite settings.xml
23+
java-version: '17'
24+
distribution: 'adopt'
25+
server-id: sonatype
26+
server-username: OSSRH_USERNAME
27+
server-password: OSSRH_PASSWORD
28+
gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }}
29+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
30+
31+
- name: Set Release version env variable
32+
run: |
33+
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
34+
35+
- name: Publish to Maven Central
36+
if: contains('${{ env.RELEASE_VERSION }}', 'SNAPSHOT')
37+
run: mvn clean deploy -P snapshot -Dmaven.test.skip=true
38+
env:
39+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
40+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
41+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

Diff for: README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@
2525
![](https://i.loli.net/2020/09/27/dbMiYhwTBurZK4y.png)
2626

2727
## 如何使用
28+
| 版本 | 支持 |
29+
|-------|--|
30+
| 3.0.0 | 适配 SpringBoot3.x |
31+
| 1.0.1 | 适配 SpringBoot2.x |
2832

2933
- 1. 引入依赖
3034

3135
```xml
3236
<dependency>
3337
<groupId>com.pig4cloud.plugin</groupId>
3438
<artifactId>multilevel-cache-spring-boot-starter</artifactId>
35-
<version>1.0.1</version>
39+
<version>${lastVersion}</version>
3640
</dependency>
3741
```
3842

Diff for: pom.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.7.5</version>
8+
<version>3.0.0</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.pig4cloud.plugin</groupId>
1212
<artifactId>multilevel-cache-spring-boot-starter</artifactId>
13-
<version>1.0.1</version>
13+
<version>3.0.0-SNAPSHOT</version>
1414
<name>multilevel-cache-spring-boot-starter</name>
1515
<description>support L1 caffeine and L2 redis cache</description>
1616
<url>https://pig4cloud.com</url>
@@ -36,8 +36,8 @@
3636
</scm>
3737

3838
<properties>
39-
<java.version>1.8</java.version>
40-
<mica.version>2.3.1</mica.version>
39+
<java.version>17</java.version>
40+
<mica.version>3.0.0</mica.version>
4141
<spring.checkstyle.plugin>0.0.29</spring.checkstyle.plugin>
4242
</properties>
4343

@@ -122,7 +122,7 @@
122122
<plugin>
123123
<groupId>org.apache.maven.plugins</groupId>
124124
<artifactId>maven-javadoc-plugin</artifactId>
125-
<version>2.9.1</version>
125+
<version>3.3.2</version>
126126
<configuration>
127127
<show>private</show>
128128
<nohelp>true</nohelp>
@@ -165,7 +165,7 @@
165165
<plugin>
166166
<groupId>org.sonatype.plugins</groupId>
167167
<artifactId>nexus-staging-maven-plugin</artifactId>
168-
<version>1.6.8</version>
168+
<version>1.6.13</version>
169169
<extensions>true</extensions>
170170
<configuration>
171171
<serverId>sonatype</serverId>

Diff for: src/main/java/com/pig4cloud/plugin/cache/MultilevelCacheAutoConfiguration.java

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.pig4cloud.plugin.cache.support.ServerIdGenerator;
88
import org.springframework.beans.factory.ObjectProvider;
99
import org.springframework.beans.factory.annotation.Qualifier;
10+
import org.springframework.boot.autoconfigure.AutoConfiguration;
1011
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
1112
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
1213
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -28,6 +29,7 @@
2829
* @version 1.0.0
2930
*/
3031
@Configuration(proxyBeanMethods = false)
32+
@AutoConfiguration
3133
@AutoConfigureAfter(RedisAutoConfiguration.class)
3234
@EnableConfigurationProperties(CacheConfigProperties.class)
3335
public class MultilevelCacheAutoConfiguration {

Diff for: src/main/java/com/pig4cloud/plugin/cache/support/RedisCaffeineCache.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ protected Object getCaffeineValue(Object key) {
301301

302302
@Override
303303
@SuppressWarnings("unchecked")
304-
public @NonNull Map<Object, Object> getAll(@NonNull Iterable<?> keys,
305-
@NonNull Function<Iterable<?>, @NonNull Map<Object, Object>> mappingFunction) {
304+
public @NonNull Map<Object, Object> getAll(Iterable<?> keys,
305+
Function<? super Set<?>, ? extends Map<?, ?>> mappingFunction) {
306306
GetAllContext context = new GetAllContext((Iterable<Object>) keys);
307307
context.saveRedisAbsentKeys = true;
308308
doGetAll(context);
@@ -315,7 +315,7 @@ protected Object getCaffeineValue(Object key) {
315315
return result;
316316
}
317317
// 从 mappingFunction 中获取值
318-
Map<Object, Object> mappingKeyValues = mappingFunction.apply(context.redisAbsentKeys);
318+
Map<?, ?> mappingKeyValues = mappingFunction.apply(context.redisAbsentKeys);
319319
putAll(mappingKeyValues);
320320
Map<Object, Object> result = new HashMap<>(cachedKeyValues.size() + mappingKeyValues.size(), 1);
321321
cachedKeyValues.forEach((k, v) -> result.put(k, fromStoreValue(v)));
@@ -343,7 +343,7 @@ protected void doGetAll(GetAllContext context) {
343343
boolean saveCacheAbsentKeys = context.saveRedisAbsentKeys;
344344
if (saveCacheAbsentKeys) {
345345
// mappingFunction 的参数
346-
context.redisAbsentKeys = new ArrayList<>(redisAbsentCount);
346+
context.redisAbsentKeys = new HashSet<>(redisAbsentCount);
347347
}
348348
int index = 0;
349349
for (Object key : caffeineAbsentKeys) {
@@ -376,7 +376,7 @@ public GetAllContext(Iterable<Object> allKeys) {
376376
/**
377377
* redis中未查询到的key
378378
*/
379-
protected List<Object> redisAbsentKeys;
379+
protected Set<Object> redisAbsentKeys;
380380

381381
/**
382382
* redis中未查询到的key数量

0 commit comments

Comments
 (0)