记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
614c05f8
Commit
614c05f8
authored
Jul 07, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~config:redis.key+prefix;
parent
06142cfc
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
139 additions
and
96 deletions
+139
-96
AbstractRedisUtil.java
....liquidnet.common.cache/redis/util/AbstractRedisUtil.java
+63
-84
RedisAdamUtil.java
.../com.liquidnet.common.cache/redis/util/RedisAdamUtil.java
+9
-1
RedisCandyUtil.java
...com.liquidnet.common.cache/redis/util/RedisCandyUtil.java
+9
-1
RedisDragonUtil.java
...om.liquidnet.common.cache/redis/util/RedisDragonUtil.java
+8
-2
RedisGalaxyUtil.java
...om.liquidnet.common.cache/redis/util/RedisGalaxyUtil.java
+9
-1
RedisGoblinUtil.java
...om.liquidnet.common.cache/redis/util/RedisGoblinUtil.java
+9
-2
RedisKylinUtil.java
...com.liquidnet.common.cache/redis/util/RedisKylinUtil.java
+8
-2
RedisQueueUtil.java
...com.liquidnet.common.cache/redis/util/RedisQueueUtil.java
+6
-1
RedisSweetUtil.java
...com.liquidnet.common.cache/redis/util/RedisSweetUtil.java
+9
-1
RedisUtil.java
...java/com.liquidnet.common.cache/redis/util/RedisUtil.java
+9
-1
No files found.
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/AbstractRedisUtil.java
View file @
614c05f8
...
@@ -18,6 +18,11 @@ import java.util.concurrent.TimeUnit;
...
@@ -18,6 +18,11 @@ import java.util.concurrent.TimeUnit;
* @date 2020/8/26 13:11
* @date 2020/8/26 13:11
*/
*/
public
abstract
class
AbstractRedisUtil
{
public
abstract
class
AbstractRedisUtil
{
/**
* 补全KEY前缀
*/
public
abstract
String
fillingKey
(
String
key
);
/**
/**
* 获取redis初始化信息
* 获取redis初始化信息
*/
*/
...
@@ -48,6 +53,7 @@ public abstract class AbstractRedisUtil {
...
@@ -48,6 +53,7 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
expire
(
String
key
,
long
time
)
{
public
boolean
expire
(
String
key
,
long
time
)
{
key
=
this
.
fillingKey
(
key
);
if
(
time
>
0
)
{
if
(
time
>
0
)
{
...
@@ -56,7 +62,6 @@ public abstract class AbstractRedisUtil {
...
@@ -56,7 +62,6 @@ public abstract class AbstractRedisUtil {
}
}
return
true
;
return
true
;
}
}
...
@@ -68,9 +73,9 @@ public abstract class AbstractRedisUtil {
...
@@ -68,9 +73,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
long
getExpire
(
String
key
)
{
public
long
getExpire
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
getExpire
(
key
,
TimeUnit
.
SECONDS
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
getExpire
(
key
,
TimeUnit
.
SECONDS
);
}
}
...
@@ -82,9 +87,9 @@ public abstract class AbstractRedisUtil {
...
@@ -82,9 +87,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
hasKey
(
String
key
)
{
public
boolean
hasKey
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
hasKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
hasKey
(
key
);
}
}
/**
/**
...
@@ -93,6 +98,8 @@ public abstract class AbstractRedisUtil {
...
@@ -93,6 +98,8 @@ public abstract class AbstractRedisUtil {
* @param prefix Key前缀
* @param prefix Key前缀
*/
*/
public
void
delKeysByPrefix
(
String
prefix
)
{
public
void
delKeysByPrefix
(
String
prefix
)
{
prefix
=
this
.
fillingKey
(
prefix
);
if
(
null
!=
prefix
&&
prefix
.
trim
().
length
()
>
0
)
{
if
(
null
!=
prefix
&&
prefix
.
trim
().
length
()
>
0
)
{
for
(
Integer
key
:
this
.
getRedisConfig
().
redisTemplateMap
.
keySet
())
{
for
(
Integer
key
:
this
.
getRedisConfig
().
redisTemplateMap
.
keySet
())
{
Set
<
String
>
keys
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
key
).
keys
(
prefix
.
concat
(
"*"
));
Set
<
String
>
keys
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
key
).
keys
(
prefix
.
concat
(
"*"
));
...
@@ -118,13 +125,15 @@ public abstract class AbstractRedisUtil {
...
@@ -118,13 +125,15 @@ public abstract class AbstractRedisUtil {
if
(
key
!=
null
&&
key
.
length
>
0
)
{
if
(
key
!=
null
&&
key
.
length
>
0
)
{
if
(
key
.
length
==
1
)
{
if
(
key
.
length
==
1
)
{
String
keyStr
=
this
.
fillingKey
(
key
[
0
]);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
[
0
])).
delete
(
key
[
0
]);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
keyStr
)).
delete
(
keyStr
);
}
else
{
}
else
{
// redisTemplate.delete(CollectionUtils.arrayToList(key));
// redisTemplate.delete(CollectionUtils.arrayToList(key));
for
(
String
keyStr
:
key
)
{
for
(
String
keyStr
:
key
)
{
keyStr
=
this
.
fillingKey
(
keyStr
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
keyStr
)).
delete
(
keyStr
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
keyStr
)).
delete
(
keyStr
);
}
}
}
}
...
@@ -150,6 +159,7 @@ public abstract class AbstractRedisUtil {
...
@@ -150,6 +159,7 @@ public abstract class AbstractRedisUtil {
hashMap
=
hashMapIntegerArrayList
();
hashMap
=
hashMapIntegerArrayList
();
//构建 需要删除的Redis HashMapDBKey
//构建 需要删除的Redis HashMapDBKey
for
(
String
keyStr
:
key
)
{
for
(
String
keyStr
:
key
)
{
keyStr
=
this
.
fillingKey
(
keyStr
);
Integer
dbPosition
=
this
.
getIndex
(
keyStr
);
Integer
dbPosition
=
this
.
getIndex
(
keyStr
);
ArrayList
<
String
>
dbArray
;
ArrayList
<
String
>
dbArray
;
if
(
hashMap
.
containsKey
(
dbPosition
))
{
if
(
hashMap
.
containsKey
(
dbPosition
))
{
...
@@ -179,9 +189,13 @@ public abstract class AbstractRedisUtil {
...
@@ -179,9 +189,13 @@ public abstract class AbstractRedisUtil {
*/
*/
public
Object
get
(
String
key
)
{
public
Object
get
(
String
key
)
{
if
(
null
==
key
)
{
return
null
;
}
return
key
==
null
?
null
:
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
get
(
key
);
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
get
(
key
);
}
}
...
@@ -194,13 +208,11 @@ public abstract class AbstractRedisUtil {
...
@@ -194,13 +208,11 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
set
(
String
key
,
Object
value
)
{
public
boolean
set
(
String
key
,
Object
value
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
set
(
key
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
set
(
key
,
value
);
return
true
;
return
true
;
}
}
...
@@ -214,7 +226,7 @@ public abstract class AbstractRedisUtil {
...
@@ -214,7 +226,7 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
set
(
String
key
,
Object
value
,
long
time
)
{
public
boolean
set
(
String
key
,
Object
value
,
long
time
)
{
key
=
this
.
fillingKey
(
key
);
if
(
time
>
0
)
{
if
(
time
>
0
)
{
RedisTemplate
<
String
,
Object
>
redisTemplate
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
));
RedisTemplate
<
String
,
Object
>
redisTemplate
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
));
...
@@ -227,11 +239,8 @@ public abstract class AbstractRedisUtil {
...
@@ -227,11 +239,8 @@ public abstract class AbstractRedisUtil {
}
}
return
true
;
return
true
;
}
}
/**
/**
* 递增
* 递增
*
*
...
@@ -239,7 +248,6 @@ public abstract class AbstractRedisUtil {
...
@@ -239,7 +248,6 @@ public abstract class AbstractRedisUtil {
* @param delta 要增加几(大于0)
* @param delta 要增加几(大于0)
* @return
* @return
*/
*/
public
long
incr
(
String
key
,
long
delta
)
{
public
long
incr
(
String
key
,
long
delta
)
{
if
(
delta
<
0
)
{
if
(
delta
<
0
)
{
...
@@ -248,8 +256,9 @@ public abstract class AbstractRedisUtil {
...
@@ -248,8 +256,9 @@ public abstract class AbstractRedisUtil {
}
}
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
increment
(
key
,
delta
);
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
increment
(
key
,
delta
);
}
}
...
@@ -269,8 +278,9 @@ public abstract class AbstractRedisUtil {
...
@@ -269,8 +278,9 @@ public abstract class AbstractRedisUtil {
}
}
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
increment
(
key
,
-
delta
);
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForValue
().
increment
(
key
,
-
delta
);
}
}
...
@@ -283,12 +293,15 @@ public abstract class AbstractRedisUtil {
...
@@ -283,12 +293,15 @@ public abstract class AbstractRedisUtil {
* @param item 项 不能为null
* @param item 项 不能为null
* @return 值
* @return 值
*/
*/
public
Object
hget
(
String
key
,
String
item
)
{
public
Object
hget
(
String
key
,
String
item
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
get
(
key
,
item
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
get
(
key
,
item
);
}
}
public
Object
hkeys
(
String
key
)
{
public
Object
hkeys
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
keys
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
keys
(
key
);
}
}
...
@@ -301,9 +314,9 @@ public abstract class AbstractRedisUtil {
...
@@ -301,9 +314,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
Map
<
Object
,
Object
>
hmget
(
String
key
)
{
public
Map
<
Object
,
Object
>
hmget
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
entries
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
entries
(
key
);
}
}
...
@@ -316,13 +329,11 @@ public abstract class AbstractRedisUtil {
...
@@ -316,13 +329,11 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
hmset
(
String
key
,
Map
<
String
,
Object
>
map
)
{
public
boolean
hmset
(
String
key
,
Map
<
String
,
Object
>
map
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
putAll
(
key
,
map
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
putAll
(
key
,
map
);
return
true
;
return
true
;
}
}
...
@@ -336,7 +347,7 @@ public abstract class AbstractRedisUtil {
...
@@ -336,7 +347,7 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
hmset
(
String
key
,
Map
<
String
,
Object
>
map
,
long
time
)
{
public
boolean
hmset
(
String
key
,
Map
<
String
,
Object
>
map
,
long
time
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
putAll
(
key
,
map
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
putAll
(
key
,
map
);
...
@@ -345,10 +356,7 @@ public abstract class AbstractRedisUtil {
...
@@ -345,10 +356,7 @@ public abstract class AbstractRedisUtil {
expire
(
key
,
time
);
expire
(
key
,
time
);
}
}
return
true
;
return
true
;
}
}
...
@@ -362,13 +370,11 @@ public abstract class AbstractRedisUtil {
...
@@ -362,13 +370,11 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
hset
(
String
key
,
String
item
,
Object
value
)
{
public
boolean
hset
(
String
key
,
String
item
,
Object
value
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
put
(
key
,
item
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
put
(
key
,
item
,
value
);
return
true
;
return
true
;
}
}
...
@@ -383,7 +389,7 @@ public abstract class AbstractRedisUtil {
...
@@ -383,7 +389,7 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
hset
(
String
key
,
String
item
,
Object
value
,
long
time
)
{
public
boolean
hset
(
String
key
,
String
item
,
Object
value
,
long
time
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
put
(
key
,
item
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
put
(
key
,
item
,
value
);
...
@@ -394,8 +400,6 @@ public abstract class AbstractRedisUtil {
...
@@ -394,8 +400,6 @@ public abstract class AbstractRedisUtil {
}
}
return
true
;
return
true
;
}
}
...
@@ -407,9 +411,9 @@ public abstract class AbstractRedisUtil {
...
@@ -407,9 +411,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
void
hdel
(
String
key
,
Object
...
item
)
{
public
void
hdel
(
String
key
,
Object
...
item
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
delete
(
key
,
item
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
delete
(
key
,
item
);
}
}
...
@@ -422,9 +426,9 @@ public abstract class AbstractRedisUtil {
...
@@ -422,9 +426,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
hHasKey
(
String
key
,
String
item
)
{
public
boolean
hHasKey
(
String
key
,
String
item
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
hasKey
(
key
,
item
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
hasKey
(
key
,
item
);
}
}
...
@@ -438,9 +442,9 @@ public abstract class AbstractRedisUtil {
...
@@ -438,9 +442,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
double
hincr
(
String
key
,
String
item
,
double
by
)
{
public
double
hincr
(
String
key
,
String
item
,
double
by
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
increment
(
key
,
item
,
by
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
increment
(
key
,
item
,
by
);
}
}
...
@@ -454,9 +458,9 @@ public abstract class AbstractRedisUtil {
...
@@ -454,9 +458,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
double
hdecr
(
String
key
,
String
item
,
double
by
)
{
public
double
hdecr
(
String
key
,
String
item
,
double
by
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
increment
(
key
,
item
,
-
by
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForHash
().
increment
(
key
,
item
,
-
by
);
}
}
...
@@ -470,11 +474,9 @@ public abstract class AbstractRedisUtil {
...
@@ -470,11 +474,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
Set
<
Object
>
sGet
(
String
key
)
{
public
Set
<
Object
>
sGet
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
members
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
members
(
key
);
}
}
...
@@ -487,11 +489,9 @@ public abstract class AbstractRedisUtil {
...
@@ -487,11 +489,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
sHasKey
(
String
key
,
Object
value
)
{
public
boolean
sHasKey
(
String
key
,
Object
value
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
isMember
(
key
,
value
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
isMember
(
key
,
value
);
}
}
...
@@ -504,11 +504,9 @@ public abstract class AbstractRedisUtil {
...
@@ -504,11 +504,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
long
sSet
(
String
key
,
Object
...
values
)
{
public
long
sSet
(
String
key
,
Object
...
values
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
add
(
key
,
values
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
add
(
key
,
values
);
}
}
...
@@ -522,7 +520,7 @@ public abstract class AbstractRedisUtil {
...
@@ -522,7 +520,7 @@ public abstract class AbstractRedisUtil {
*/
*/
public
long
sSetAndTime
(
String
key
,
long
time
,
Object
...
values
)
{
public
long
sSetAndTime
(
String
key
,
long
time
,
Object
...
values
)
{
key
=
this
.
fillingKey
(
key
);
Long
count
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
add
(
key
,
values
);
Long
count
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
add
(
key
,
values
);
...
@@ -531,8 +529,6 @@ public abstract class AbstractRedisUtil {
...
@@ -531,8 +529,6 @@ public abstract class AbstractRedisUtil {
expire
(
key
,
time
);
expire
(
key
,
time
);
return
count
;
return
count
;
}
}
...
@@ -542,13 +538,10 @@ public abstract class AbstractRedisUtil {
...
@@ -542,13 +538,10 @@ public abstract class AbstractRedisUtil {
* @param key 键
* @param key 键
* @return
* @return
*/
*/
public
long
sGetSetSize
(
String
key
)
{
public
long
sGetSetSize
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
size
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
size
(
key
);
}
}
...
@@ -559,15 +552,12 @@ public abstract class AbstractRedisUtil {
...
@@ -559,15 +552,12 @@ public abstract class AbstractRedisUtil {
* @param values 值 可以是多个
* @param values 值 可以是多个
* @return 移除的个数
* @return 移除的个数
*/
*/
public
long
setRemove
(
String
key
,
Object
...
values
)
{
public
long
setRemove
(
String
key
,
Object
...
values
)
{
key
=
this
.
fillingKey
(
key
);
Long
count
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
remove
(
key
,
values
);
Long
count
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForSet
().
remove
(
key
,
values
);
return
count
;
return
count
;
}
}
// ===============================list=================================
// ===============================list=================================
...
@@ -583,11 +573,9 @@ public abstract class AbstractRedisUtil {
...
@@ -583,11 +573,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
List
<
Object
>
lGet
(
String
key
,
long
start
,
long
end
)
{
public
List
<
Object
>
lGet
(
String
key
,
long
start
,
long
end
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
range
(
key
,
start
,
end
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
range
(
key
,
start
,
end
);
}
}
...
@@ -599,11 +587,9 @@ public abstract class AbstractRedisUtil {
...
@@ -599,11 +587,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
long
lGetListSize
(
String
key
)
{
public
long
lGetListSize
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
size
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
size
(
key
);
}
}
...
@@ -616,11 +602,9 @@ public abstract class AbstractRedisUtil {
...
@@ -616,11 +602,9 @@ public abstract class AbstractRedisUtil {
*/
*/
public
Object
lGetIndex
(
String
key
,
long
index
)
{
public
Object
lGetIndex
(
String
key
,
long
index
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
index
(
key
,
index
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
index
(
key
,
index
);
}
}
...
@@ -632,13 +616,11 @@ public abstract class AbstractRedisUtil {
...
@@ -632,13 +616,11 @@ public abstract class AbstractRedisUtil {
* @return
* @return
*/
*/
public
boolean
lSet
(
String
key
,
Object
value
)
{
public
boolean
lSet
(
String
key
,
Object
value
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPush
(
key
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPush
(
key
,
value
);
return
true
;
return
true
;
}
}
...
@@ -652,7 +634,7 @@ public abstract class AbstractRedisUtil {
...
@@ -652,7 +634,7 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
lSet
(
String
key
,
Object
value
,
long
time
)
{
public
boolean
lSet
(
String
key
,
Object
value
,
long
time
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPush
(
key
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPush
(
key
,
value
);
...
@@ -661,8 +643,6 @@ public abstract class AbstractRedisUtil {
...
@@ -661,8 +643,6 @@ public abstract class AbstractRedisUtil {
expire
(
key
,
time
);
expire
(
key
,
time
);
return
true
;
return
true
;
}
}
...
@@ -674,13 +654,11 @@ public abstract class AbstractRedisUtil {
...
@@ -674,13 +654,11 @@ public abstract class AbstractRedisUtil {
* @return
* @return
*/
*/
public
boolean
lSet
(
String
key
,
List
<
Object
>
value
)
{
public
boolean
lSet
(
String
key
,
List
<
Object
>
value
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPushAll
(
key
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPushAll
(
key
,
value
);
return
true
;
return
true
;
}
}
...
@@ -694,7 +672,7 @@ public abstract class AbstractRedisUtil {
...
@@ -694,7 +672,7 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
lSet
(
String
key
,
List
<
Object
>
value
,
long
time
)
{
public
boolean
lSet
(
String
key
,
List
<
Object
>
value
,
long
time
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPushAll
(
key
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
rightPushAll
(
key
,
value
);
...
@@ -703,8 +681,6 @@ public abstract class AbstractRedisUtil {
...
@@ -703,8 +681,6 @@ public abstract class AbstractRedisUtil {
expire
(
key
,
time
);
expire
(
key
,
time
);
return
true
;
return
true
;
}
}
...
@@ -718,13 +694,11 @@ public abstract class AbstractRedisUtil {
...
@@ -718,13 +694,11 @@ public abstract class AbstractRedisUtil {
*/
*/
public
boolean
lUpdateIndex
(
String
key
,
long
index
,
Object
value
)
{
public
boolean
lUpdateIndex
(
String
key
,
long
index
,
Object
value
)
{
key
=
this
.
fillingKey
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
set
(
key
,
index
,
value
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
set
(
key
,
index
,
value
);
return
true
;
return
true
;
}
}
...
@@ -736,15 +710,12 @@ public abstract class AbstractRedisUtil {
...
@@ -736,15 +710,12 @@ public abstract class AbstractRedisUtil {
* @param value 值
* @param value 值
* @return 移除的个数
* @return 移除的个数
*/
*/
public
long
lRemove
(
String
key
,
long
count
,
Object
value
)
{
public
long
lRemove
(
String
key
,
long
count
,
Object
value
)
{
key
=
this
.
fillingKey
(
key
);
Long
remove
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
remove
(
key
,
count
,
value
);
Long
remove
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
remove
(
key
,
count
,
value
);
return
remove
;
return
remove
;
}
}
public
RedisTemplate
<
String
,
Object
>
getRedisTemplateByDb
(
int
db
)
{
public
RedisTemplate
<
String
,
Object
>
getRedisTemplateByDb
(
int
db
)
{
...
@@ -753,15 +724,20 @@ public abstract class AbstractRedisUtil {
...
@@ -753,15 +724,20 @@ public abstract class AbstractRedisUtil {
public
Object
getDB15RedisHGet
(
String
redisKey
,
String
item
)
{
public
Object
getDB15RedisHGet
(
String
redisKey
,
String
item
)
{
redisKey
=
this
.
fillingKey
(
redisKey
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
15
).
opsForHash
().
get
(
redisKey
,
item
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
15
).
opsForHash
().
get
(
redisKey
,
item
);
}
}
public
Object
getDB15RedisGet
(
String
redisKey
)
{
public
Object
getDB15RedisGet
(
String
redisKey
)
{
redisKey
=
this
.
fillingKey
(
redisKey
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
15
).
opsForValue
().
get
(
redisKey
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
15
).
opsForValue
().
get
(
redisKey
);
}
}
public
boolean
getDB15RedisHasKey
(
String
redisKey
,
String
item
)
{
public
boolean
getDB15RedisHasKey
(
String
redisKey
,
String
item
)
{
redisKey
=
this
.
fillingKey
(
redisKey
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
15
).
opsForSet
().
isMember
(
redisKey
,
item
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
15
).
opsForSet
().
isMember
(
redisKey
,
item
);
}
}
...
@@ -773,6 +749,8 @@ public abstract class AbstractRedisUtil {
...
@@ -773,6 +749,8 @@ public abstract class AbstractRedisUtil {
* @return
* @return
*/
*/
public
boolean
lock
(
String
key
,
int
value
,
long
releaseTime
)
{
public
boolean
lock
(
String
key
,
int
value
,
long
releaseTime
)
{
key
=
this
.
fillingKey
(
key
);
// 尝试获取锁
// 尝试获取锁
RedisTemplate
<
String
,
Object
>
redisTemplate
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
));
RedisTemplate
<
String
,
Object
>
redisTemplate
=
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
));
Boolean
boo
=
redisTemplate
.
opsForValue
().
setIfAbsent
(
key
,
value
,
releaseTime
,
TimeUnit
.
SECONDS
);
Boolean
boo
=
redisTemplate
.
opsForValue
().
setIfAbsent
(
key
,
value
,
releaseTime
,
TimeUnit
.
SECONDS
);
...
@@ -785,6 +763,7 @@ public abstract class AbstractRedisUtil {
...
@@ -785,6 +763,7 @@ public abstract class AbstractRedisUtil {
** @param key
** @param key
*/
*/
public
void
uLock
(
String
key
)
{
public
void
uLock
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
// 删除key即可释放锁
// 删除key即可释放锁
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
delete
(
key
);
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
delete
(
key
);
}
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisAdamUtil.java
View file @
614c05f8
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
import
com.liquidnet.common.cache.redis.config.RedisAdamConfig
;
import
com.liquidnet.common.cache.redis.config.RedisAdamConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
public
final
class
RedisAdamUtil
extends
AbstractRedisUtil
{
public
final
class
RedisAdamUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisAdamConfig
redisConfig
;
private
RedisAdamConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"redisAdamUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"redisAdamUtil.totalDbs
:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisCandyUtil.java
View file @
614c05f8
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
import
com.liquidnet.common.cache.redis.config.RedisCandyConfig
;
import
com.liquidnet.common.cache.redis.config.RedisCandyConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -19,10 +20,17 @@ import org.springframework.stereotype.Component;
...
@@ -19,10 +20,17 @@ import org.springframework.stereotype.Component;
public
final
class
RedisCandyUtil
extends
AbstractRedisUtil
{
public
final
class
RedisCandyUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisCandyConfig
redisConfig
;
private
RedisCandyConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"redisCandyUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"redisCandyUtil.totalDbs
:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisDragonUtil.java
View file @
614c05f8
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
import
com.liquidnet.common.cache.redis.config.RedisDragonConfig
;
import
com.liquidnet.common.cache.redis.config.RedisDragonConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -20,15 +21,20 @@ import org.springframework.stereotype.Component;
...
@@ -20,15 +21,20 @@ import org.springframework.stereotype.Component;
public
final
class
RedisDragonUtil
extends
AbstractRedisUtil
{
public
final
class
RedisDragonUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisDragonConfig
redisConfig
;
private
RedisDragonConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"redisDragonUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"redisDragonUtil.totalDbs
:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
@Override
@Override
AbstractRedisConfig
getRedisConfig
()
{
AbstractRedisConfig
getRedisConfig
()
{
return
this
.
redisConfig
;
return
this
.
redisConfig
;
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisGalaxyUtil.java
View file @
614c05f8
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
import
com.liquidnet.common.cache.redis.config.RedisGalaxyConfig
;
import
com.liquidnet.common.cache.redis.config.RedisGalaxyConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
public
final
class
RedisGalaxyUtil
extends
AbstractRedisUtil
{
public
final
class
RedisGalaxyUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisGalaxyConfig
redisConfig
;
private
RedisGalaxyConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"RedisGalaxyUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"RedisGalaxyUtil.totalDbs
:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisGoblinUtil.java
View file @
614c05f8
package
com
.
liquidnet
.
common
.
cache
.
redis
.
util
;
package
com
.
liquidnet
.
common
.
cache
.
redis
.
util
;
import
com.liquidnet.common.cache.redis.config.AbstractRedisConfig
;
import
com.liquidnet.common.cache.redis.config.AbstractRedisConfig
;
import
com.liquidnet.common.cache.redis.config.RedisAdamConfig
;
import
com.liquidnet.common.cache.redis.config.RedisGoblinConfig
;
import
com.liquidnet.common.cache.redis.config.RedisGoblinConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -21,10 +21,17 @@ import org.springframework.stereotype.Component;
...
@@ -21,10 +21,17 @@ import org.springframework.stereotype.Component;
public
final
class
RedisGoblinUtil
extends
AbstractRedisUtil
{
public
final
class
RedisGoblinUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisGoblinConfig
redisConfig
;
private
RedisGoblinConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"redisAdamUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"redisAdamUtil.totalDbs
:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisKylinUtil.java
View file @
614c05f8
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
import
com.liquidnet.common.cache.redis.config.RedisKylinConfig
;
import
com.liquidnet.common.cache.redis.config.RedisKylinConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -20,15 +21,20 @@ import org.springframework.stereotype.Component;
...
@@ -20,15 +21,20 @@ import org.springframework.stereotype.Component;
public
final
class
RedisKylinUtil
extends
AbstractRedisUtil
{
public
final
class
RedisKylinUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisKylinConfig
redisConfig
;
private
RedisKylinConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"redisKylinUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"redisKylinUtil.totalDbs
:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
@Override
@Override
AbstractRedisConfig
getRedisConfig
()
{
AbstractRedisConfig
getRedisConfig
()
{
return
this
.
redisConfig
;
return
this
.
redisConfig
;
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisQueueUtil.java
View file @
614c05f8
...
@@ -21,9 +21,14 @@ public final class RedisQueueUtil extends AbstractRedisUtil{
...
@@ -21,9 +21,14 @@ public final class RedisQueueUtil extends AbstractRedisUtil{
@Autowired
@Autowired
private
RedisQueueConfig
redisConfig
;
private
RedisQueueConfig
redisConfig
;
@Override
public
String
fillingKey
(
String
key
)
{
return
key
;
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"RedisQueueUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"RedisQueueUtil.totalDbs
:{}==="
,
redisConfig
.
totalDbs
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisSweetUtil.java
View file @
614c05f8
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
import
com.liquidnet.common.cache.redis.config.RedisSweetConfig
;
import
com.liquidnet.common.cache.redis.config.RedisSweetConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
public
final
class
RedisSweetUtil
extends
AbstractRedisUtil
{
public
final
class
RedisSweetUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisSweetConfig
redisConfig
;
private
RedisSweetConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
log
.
info
(
"redisSweetUtil.totalDbs
==="
,
redisConfig
.
totalDbs
);
log
.
info
(
"redisSweetUtil.totalDbs
:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/RedisUtil.java
View file @
614c05f8
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.AbstractRedisConfig;
import
com.liquidnet.common.cache.redis.config.RedisConfig
;
import
com.liquidnet.common.cache.redis.config.RedisConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
...
@@ -20,10 +21,17 @@ import org.springframework.stereotype.Component;
public
final
class
RedisUtil
extends
AbstractRedisUtil
{
public
final
class
RedisUtil
extends
AbstractRedisUtil
{
@Autowired
@Autowired
private
RedisConfig
redisConfig
;
private
RedisConfig
redisConfig
;
@Value
(
"${spring.profiles.active:prod}"
)
private
String
prefix
;
@Override
public
String
fillingKey
(
String
key
)
{
return
prefix
.
equals
(
"prod"
)
?
key
:
prefix
.
concat
(
":"
).
concat
(
key
);
}
@Override
@Override
public
int
getDbs
()
{
public
int
getDbs
()
{
// log.info("redisConfig.totalDbs===",redisConfig.totalDbs
);
log
.
info
(
"redisConfig.totalDbs:{},prefix:{}==="
,
redisConfig
.
totalDbs
,
prefix
);
return
redisConfig
.
totalDbs
;
return
redisConfig
.
totalDbs
;
}
}
...
...
Write
Preview
Markdown
is supported
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