Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
普蓝开源社区
盘古开发框架
提交
192f66a5
盘古开发框架
项目概览
普蓝开源社区
/
盘古开发框架
通知
25
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
盘古开发框架
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
192f66a5
编写于
12月 17, 2021
作者:
X
xiongchun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重构框架核心,封装缓存starter:pangu-framework-cache-spring-boot-starter
上级
4b075ae0
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
259 addition
and
10 deletion
+259
-10
pangu-examples/README.md
pangu-examples/README.md
+4
-1
pangu-examples/pangu-examples-cache-layering/src/main/java/com/gitee/pulanos/pangu/showcases/cache/layering/LayeringCachePanguApplication.java
...owcases/cache/layering/LayeringCachePanguApplication.java
+2
-2
pangu-examples/pangu-examples-cache-layering/src/main/resources/application-dev.properties
...he-layering/src/main/resources/application-dev.properties
+0
-7
pangu-examples/pangu-examples-cache-single/.gitignore
pangu-examples/pangu-examples-cache-single/.gitignore
+26
-0
pangu-examples/pangu-examples-cache-single/README.md
pangu-examples/pangu-examples-cache-single/README.md
+5
-0
pangu-examples/pangu-examples-cache-single/pom.xml
pangu-examples/pangu-examples-cache-single/pom.xml
+49
-0
pangu-examples/pangu-examples-cache-single/src/main/java/com/gitee/pulanos/pangu/showcases/cache/single/SimpleCachePanguApplication.java
...u/showcases/cache/single/SimpleCachePanguApplication.java
+35
-0
pangu-examples/pangu-examples-cache-single/src/main/java/com/gitee/pulanos/pangu/showcases/cache/single/pojo/UserVO.java
...tee/pulanos/pangu/showcases/cache/single/pojo/UserVO.java
+43
-0
pangu-examples/pangu-examples-cache-single/src/main/java/com/gitee/pulanos/pangu/showcases/cache/single/service/ApiBasedDemoService.java
...u/showcases/cache/single/service/ApiBasedDemoService.java
+30
-0
pangu-examples/pangu-examples-cache-single/src/main/resources/application-dev.properties
...ache-single/src/main/resources/application-dev.properties
+26
-0
pangu-examples/pangu-examples-cache-single/src/main/resources/application.properties
...es-cache-single/src/main/resources/application.properties
+17
-0
pangu-examples/pangu-examples-cache-single/src/test/java/com/gitee/pulanos/pangu/showcases/cache/single/service/ApiBasedDemoServiceTest.java
...owcases/cache/single/service/ApiBasedDemoServiceTest.java
+21
-0
pangu-examples/pom.xml
pangu-examples/pom.xml
+1
-0
未找到文件。
pangu-examples/README.md
浏览文件 @
192f66a5
...
...
@@ -24,7 +24,10 @@
3.
分页查询和手工映复杂SQL的方法
-
**pangu-examples-cache-layering**
1.
如何使用两级缓存(本地缓存+Redis集中缓存)。
1.
如何使用两级缓存(本地缓存+Redis集中缓存)
-
**pangu-examples-cache-layering**
1.
如何使用原生的一级缓存RedisTemplate API
-
**pangu-examples-dubbo-api**
1.
开发Dubbo服务时接口文件和POJO相关类的打包模块
...
...
pangu-examples/pangu-examples-cache-layering/src/main/java/com/gitee/pulanos/pangu/showcases/cache/layering/CachePanguApplication.java
→
pangu-examples/pangu-examples-cache-layering/src/main/java/com/gitee/pulanos/pangu/showcases/cache/layering/
Layering
CachePanguApplication.java
浏览文件 @
192f66a5
...
...
@@ -28,10 +28,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@Slf4j
@EnableLayeringCache
@SpringBootApplication
public
class
CachePanguApplication
{
public
class
Layering
CachePanguApplication
{
public
static
void
main
(
String
[]
args
)
{
PanGuApplicationBuilder
.
init
(
CachePanguApplication
.
class
).
run
(
args
);
PanGuApplicationBuilder
.
init
(
Layering
CachePanguApplication
.
class
).
run
(
args
);
}
}
\ No newline at end of file
pangu-examples/pangu-examples-cache-layering/src/main/resources/application-dev.properties
浏览文件 @
192f66a5
...
...
@@ -16,13 +16,6 @@
#
spring.application.name
=
pangu-examples-cache-layering
# spring-cache \u4E00\u7EA7\u7F13\u5B58
spring.redis.host
=
localhost
spring.redis.database
=
1
spring.redis.port
=
6379
spring.redis.password
=
# layering-cache \u591A\u7EA7\u7F13\u5B58
# \u7F13\u5B58\u76D1\u63A7\u7EDF\u8BA1\u5F00\u5173 \u7F3A\u7701true
layering-cache.stats
=
false
...
...
pangu-examples/pangu-examples-cache-single/.gitignore
0 → 100644
浏览文件 @
192f66a5
/target/
/bin/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
pangu-examples/pangu-examples-cache-single/README.md
0 → 100644
浏览文件 @
192f66a5
#### :mushroom: 本范例演示功能
1.
如何使用原生的一级缓存RedisTemplate API。
**更多开发指南请参考盘古平台相关文档说明。**
\ No newline at end of file
pangu-examples/pangu-examples-cache-single/pom.xml
0 → 100644
浏览文件 @
192f66a5
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.gitee.pulanos.pangu
</groupId>
<artifactId>
pangu-parent
</artifactId>
<version>
5.0.7
</version>
<relativePath/>
</parent>
<groupId>
com.gitee.pulanos.pangu
</groupId>
<artifactId>
pangu-examples-cache-single
</artifactId>
<packaging>
jar
</packaging>
<version>
1.0.0
</version>
<dependencies>
<dependency>
<groupId>
com.gitee.pulanos.pangu
</groupId>
<artifactId>
pangu-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
com.gitee.pulanos.pangu
</groupId>
<artifactId>
pangu-cache-spring-boot-starter
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
${spring-boot-maven-plugin.version}
</version>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
${maven-compiler-plugin.version}
</version>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
pangu-examples/pangu-examples-cache-single/src/main/java/com/gitee/pulanos/pangu/showcases/cache/single/SimpleCachePanguApplication.java
0 → 100644
浏览文件 @
192f66a5
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.gitee.pulanos.pangu.showcases.cache.single
;
import
com.gitee.pulanos.pangu.framework.starter.PanGuApplicationBuilder
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
/**
* @author xiongchun
*/
@Slf4j
@SpringBootApplication
public
class
SimpleCachePanguApplication
{
public
static
void
main
(
String
[]
args
)
{
PanGuApplicationBuilder
.
init
(
SimpleCachePanguApplication
.
class
).
run
(
args
);
}
}
\ No newline at end of file
pangu-examples/pangu-examples-cache-single/src/main/java/com/gitee/pulanos/pangu/showcases/cache/single/pojo/UserVO.java
0 → 100644
浏览文件 @
192f66a5
package
com.gitee.pulanos.pangu.showcases.cache.single.pojo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author xiongchun
*/
@Data
@Accessors
(
chain
=
true
)
public
class
UserVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 流水号
*/
private
Long
id
;
/**
* 姓名
*/
private
String
name
;
/**
* 生日
*/
private
Date
birthday
;
/**
* 年龄
*/
private
Integer
age
;
/**
* 创建时间
*/
private
Date
gmtCreate
;
}
pangu-examples/pangu-examples-cache-single/src/main/java/com/gitee/pulanos/pangu/showcases/cache/single/service/ApiBasedDemoService.java
0 → 100644
浏览文件 @
192f66a5
package
com.gitee.pulanos.pangu.showcases.cache.single.service
;
import
com.alibaba.fastjson.JSON
;
import
com.gitee.pulanos.pangu.showcases.cache.single.pojo.UserVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
/**
* 基于API的一级缓存演示
*
* @author xiongchun
*/
@Slf4j
@Component
public
class
ApiBasedDemoService
{
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
public
void
testRedisCache
()
{
String
key
=
"user:1"
;
UserVO
userVO
=
new
UserVO
().
setId
(
1L
).
setName
(
"钱学森"
);
redisTemplate
.
opsForValue
().
set
(
key
,
JSON
.
toJSONString
(
userVO
));
String
userJson
=
redisTemplate
.
opsForValue
().
get
(
key
);
log
.
info
(
userJson
);
}
}
pangu-examples/pangu-examples-cache-single/src/main/resources/application-dev.properties
0 → 100644
浏览文件 @
192f66a5
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.application.name
=
pangu-examples-cache-single
# spring-cache \u4E00\u7EA7\u7F13\u5B58
spring.redis.host
=
localhost
spring.redis.database
=
1
spring.redis.port
=
6379
spring.redis.password
=
logging.level.root
=
INFO
logging.level.com.gitee.pulanos.pangu
=
INFO
\ No newline at end of file
pangu-examples/pangu-examples-cache-single/src/main/resources/application.properties
0 → 100644
浏览文件 @
192f66a5
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.profiles.active
=
${spring.profiles.active:dev}
\ No newline at end of file
pangu-examples/pangu-examples-cache-single/src/test/java/com/gitee/pulanos/pangu/showcases/cache/single/service/ApiBasedDemoServiceTest.java
0 → 100644
浏览文件 @
192f66a5
package
com.gitee.pulanos.pangu.showcases.cache.single.service
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ApiBasedDemoServiceTest
{
@Autowired
private
ApiBasedDemoService
apiBasedDemoService
;
@Test
public
void
testRedisCache
()
{
apiBasedDemoService
.
testRedisCache
();
}
}
\ No newline at end of file
pangu-examples/pom.xml
浏览文件 @
192f66a5
...
...
@@ -17,6 +17,7 @@
<module>
pangu-examples-config-local
</module>
<module>
pangu-examples-log-dynamic
</module>
<module>
pangu-examples-crud
</module>
<module>
pangu-examples-cache-single
</module>
<module>
pangu-examples-cache-layering
</module>
<module>
pangu-examples-dubbo-api
</module>
<module>
pangu-examples-dubbo-service
</module>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录