Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
streamingUserPortrait
Project
Project
Details
Activity
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
赵威
streamingUserPortrait
Commits
42353274
Commit
42353274
authored
Feb 05, 2021
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update redisclient
parent
6bf9045d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
Redis.scala
src/main/scala/com.gmei.up/utils/Redis.scala
+14
-11
No files found.
src/main/scala/com.gmei.up/utils/Redis.scala
View file @
42353274
package
com.gmei.up.utils
import
scala.concurrent.Future
import
com.redis.
RedisClient
import
com.redis.
{
RedisClient
,
RedisClientPool
}
object
Redis
{
// TODO read from config file
implicit
val
ec
:
scala.concurrent.ExecutionContext
=
scala
.
concurrent
.
ExecutionContext
.
global
val
pRc4
=
new
RedisClient
(
"172.16.50.145"
,
6379
,
0
,
Some
(
"XfkMCCdWDIU%ls$h"
),
5000
)
val
pRc4
=
new
RedisClientPool
(
"172.16.50.145"
,
6379
,
database
=
0
,
secret
=
Some
(
"XfkMCCdWDIU%ls$h"
),
timeout
=
500
)
def
save
(
contentF
:
Future
[
IndexedSeq
[
Content
]],
deviceId
:
String
,
contentType
:
String
)
:
Unit
=
{
val
key
=
s
"streaming:candidate:${contentType}:device_id:${deviceId}"
println
(
key
)
contentF
.
foreach
{
seq
=>
val
ids
=
seq
.
map
(
c
=>
c
.
id
)
if
(
ids
.
size
>
0
)
{
pRc4
.
del
(
key
)
ids
.
foreach
{
id
=>
println
(
id
)
pRc4
.
rpush
(
key
,
id
)
pRc4
.
withClient
{
client
=>
contentF
.
foreach
{
seq
=>
val
ids
=
seq
.
map
(
c
=>
c
.
id
)
if
(
ids
.
size
>
0
)
{
client
.
del
(
key
)
ids
.
foreach
{
id
=>
println
(
id
)
client
.
rpush
(
key
,
id
)
}
client
.
expire
(
key
,
60
*
60
*
24
*
15
)
}
pRc4
.
expire
(
key
,
60
*
60
*
24
*
15
)
}
}
}
...
...
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