Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
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
梁杰芳
slm-fileview
Commits
6d0846a5
Commit
6d0846a5
authored
May 20, 2019
by
陈精华
Committed by
kl
May 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复rocksdb缓存只缓存一条数据问题
parent
41d90150
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
CacheServiceRocksDBImpl.java
...cn/keking/service/cache/impl/CacheServiceRocksDBImpl.java
+13
-3
No files found.
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceRocksDBImpl.java
View file @
6d0846a5
...
...
@@ -79,7 +79,7 @@ public class CacheServiceRocksDBImpl implements CacheService {
@Override
public
void
putPDFCache
(
String
key
,
String
value
)
{
try
{
Map
<
String
,
String
>
pdfCacheItem
=
new
HashMap
<>
();
Map
<
String
,
String
>
pdfCacheItem
=
getPDFCache
();
pdfCacheItem
.
put
(
key
,
value
);
db
.
put
(
REDIS_FILE_PREVIEW_PDF_KEY
.
getBytes
(),
toByteArray
(
pdfCacheItem
));
}
catch
(
RocksDBException
|
IOException
e
)
{
...
...
@@ -90,7 +90,7 @@ public class CacheServiceRocksDBImpl implements CacheService {
@Override
public
void
putImgCache
(
String
key
,
List
<
String
>
value
)
{
try
{
Map
<
String
,
List
<
String
>>
imgCacheItem
=
new
HashMap
<>
();
Map
<
String
,
List
<
String
>>
imgCacheItem
=
getImgCache
();
imgCacheItem
.
put
(
key
,
value
);
db
.
put
(
REDIS_FILE_PREVIEW_PDF_KEY
.
getBytes
(),
toByteArray
(
imgCacheItem
));
}
catch
(
RocksDBException
|
IOException
e
)
{
...
...
@@ -145,6 +145,16 @@ public class CacheServiceRocksDBImpl implements CacheService {
return
result
;
}
public
Map
<
String
,
Integer
>
getPdfImageCaches
()
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
try
{
map
=
(
Map
<
String
,
Integer
>)
toObject
(
db
.
get
(
REDIS_FILE_PREVIEW_PDF_IMGS_KEY
.
getBytes
()));
}
catch
(
RocksDBException
|
IOException
|
ClassNotFoundException
e
)
{
LOGGER
.
error
(
"Get from RocksDB Exception"
+
e
);
}
return
map
;
}
@Override
public
Integer
getPdfImageCache
(
String
key
)
{
Integer
result
=
0
;
...
...
@@ -161,7 +171,7 @@ public class CacheServiceRocksDBImpl implements CacheService {
@Override
public
void
putPdfImageCache
(
String
pdfFilePath
,
int
num
)
{
try
{
Map
<
String
,
Integer
>
pdfImageCacheItem
=
new
HashMap
<>
();
Map
<
String
,
Integer
>
pdfImageCacheItem
=
getPdfImageCaches
();
pdfImageCacheItem
.
put
(
pdfFilePath
,
num
);
db
.
put
(
REDIS_FILE_PREVIEW_PDF_IMGS_KEY
.
getBytes
(),
toByteArray
(
pdfImageCacheItem
));
}
catch
(
RocksDBException
|
IOException
e
)
{
...
...
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