Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
62cb72ea
Unverified
Commit
62cb72ea
authored
Jul 25, 2022
by
kdjj2006
Committed by
GitHub
Jul 25, 2022
Browse files
修改HashMap初始化容量,减少不必要的扩容,提高性能 (#760)
* 获取验证码逻辑,无需加锁,不涉及线程安全问题,提高效率 * 自定义生成策略时,Map容量设置不准确,会导致无必要的扩容
parent
40177c6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java
View file @
62cb72ea
...
@@ -106,7 +106,7 @@ public class RedisConfig extends CachingConfigurerSupport {
...
@@ -106,7 +106,7 @@ public class RedisConfig extends CachingConfigurerSupport {
@Override
@Override
public
KeyGenerator
keyGenerator
()
{
public
KeyGenerator
keyGenerator
()
{
return
(
target
,
method
,
params
)
->
{
return
(
target
,
method
,
params
)
->
{
Map
<
String
,
Object
>
container
=
new
HashMap
<>(
4
);
Map
<
String
,
Object
>
container
=
new
HashMap
<>(
8
);
Class
<?>
targetClassClass
=
target
.
getClass
();
Class
<?>
targetClassClass
=
target
.
getClass
();
// 类地址
// 类地址
container
.
put
(
"class"
,
targetClassClass
.
toGenericString
());
container
.
put
(
"class"
,
targetClassClass
.
toGenericString
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment