spring cache补充
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
- [@EnableCaching](#enablecaching)
|
- [@EnableCaching](#enablecaching)
|
||||||
- [配置cache 存储](#配置cache-存储)
|
- [配置cache 存储](#配置cache-存储)
|
||||||
- [Cache Redis](#cache-redis)
|
- [Cache Redis](#cache-redis)
|
||||||
|
- [限制cache-names](#限制cache-names)
|
||||||
|
|
||||||
# Spring Cache
|
# Spring Cache
|
||||||
## Cache Abstract
|
## Cache Abstract
|
||||||
@@ -163,4 +164,10 @@ public class MyRedisCacheManagerConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
### 限制cache-names
|
||||||
|
默认情况下,cache是在需要时才创建的,但如果想要限制可用的cache-names,可以设置`cache.cache-names`属性。
|
||||||
|
在设置`cache.cache-names`属性之后,那么如果运行时应用想要获取cache-names之外的cache,将会在运行时抛出异常。
|
||||||
|
```properties
|
||||||
|
spring.cache.cache-names=cache1,cache2
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user