Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
1ec4d28e
Unverified
Commit
1ec4d28e
authored
Feb 28, 2024
by
ZackYoung
Committed by
GitHub
Feb 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BugFix] [Metadata] fix metadata cache And add an expiration date (#3198)
parent
daf59c75
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
PaimonCache.java
.../src/main/java/org/dinky/configure/cache/PaimonCache.java
+3
-1
DataSourceController.java
.../main/java/org/dinky/controller/DataSourceController.java
+1
-0
CacheData.java
...common/src/main/java/org/dinky/data/paimon/CacheData.java
+6
-0
No files found.
dinky-admin/src/main/java/org/dinky/configure/cache/PaimonCache.java
View file @
1ec4d28e
...
@@ -37,6 +37,7 @@ import com.alibaba.fastjson2.JSONWriter;
...
@@ -37,6 +37,7 @@ import com.alibaba.fastjson2.JSONWriter;
import
cn.hutool.cache.impl.TimedCache
;
import
cn.hutool.cache.impl.TimedCache
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.date.DateUtil
;
public
class
PaimonCache
extends
AbstractValueAdaptingCache
{
public
class
PaimonCache
extends
AbstractValueAdaptingCache
{
private
static
final
Class
<
CacheData
>
clazz
=
CacheData
.
class
;
private
static
final
Class
<
CacheData
>
clazz
=
CacheData
.
class
;
...
@@ -45,7 +46,7 @@ public class PaimonCache extends AbstractValueAdaptingCache {
...
@@ -45,7 +46,7 @@ public class PaimonCache extends AbstractValueAdaptingCache {
/**
/**
* TIMEOUT CACHE
* TIMEOUT CACHE
*/
*/
private
final
cn
.
hutool
.
cache
.
Cache
<
Object
,
Object
>
cache
=
new
TimedCache
<>(
1000
*
60
*
3
0
);
private
final
cn
.
hutool
.
cache
.
Cache
<
Object
,
Object
>
cache
=
new
TimedCache
<>(
1000
*
60
*
1
0
);
public
PaimonCache
(
String
cacheName
)
{
public
PaimonCache
(
String
cacheName
)
{
super
(
true
);
super
(
true
);
...
@@ -98,6 +99,7 @@ public class PaimonCache extends AbstractValueAdaptingCache {
...
@@ -98,6 +99,7 @@ public class PaimonCache extends AbstractValueAdaptingCache {
cache
.
put
(
strKey
,
value
);
cache
.
put
(
strKey
,
value
);
PaimonUtil
.
createOrGetTable
(
TABLE_NAME
,
clazz
);
PaimonUtil
.
createOrGetTable
(
TABLE_NAME
,
clazz
);
CacheData
cacheData
=
CacheData
.
builder
()
CacheData
cacheData
=
CacheData
.
builder
()
.
cacheTime
(
DateUtil
.
format
(
DateUtil
.
date
(),
"yyyy-MM-dd HH:mm"
))
.
cacheName
(
cacheName
)
.
cacheName
(
cacheName
)
.
key
(
strKey
)
.
key
(
strKey
)
.
data
(
serialize
(
value
))
.
data
(
serialize
(
value
))
...
...
dinky-admin/src/main/java/org/dinky/controller/DataSourceController.java
View file @
1ec4d28e
...
@@ -78,6 +78,7 @@ public class DataSourceController {
...
@@ -78,6 +78,7 @@ public class DataSourceController {
* @param dataBaseDTO {@link DataBaseDTO}
* @param dataBaseDTO {@link DataBaseDTO}
* @return {@link Result}< {@link Void}>
* @return {@link Result}< {@link Void}>
*/
*/
@CacheEvict
(
cacheNames
=
"metadata_schema"
,
key
=
"#dataBaseDTO.id"
)
@PutMapping
(
"/saveOrUpdate"
)
@PutMapping
(
"/saveOrUpdate"
)
@Log
(
title
=
"Insert Or Update DataBase"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@Log
(
title
=
"Insert Or Update DataBase"
,
businessType
=
BusinessType
.
INSERT_OR_UPDATE
)
@ApiOperation
(
"Insert Or Update DataBase"
)
@ApiOperation
(
"Insert Or Update DataBase"
)
...
...
dinky-common/src/main/java/org/dinky/data/paimon/CacheData.java
View file @
1ec4d28e
...
@@ -40,8 +40,14 @@ import lombok.Setter;
...
@@ -40,8 +40,14 @@ import lombok.Setter;
@Options
({
@Options
({
@Option
(
key
=
"file.format"
,
value
=
"parquet"
),
@Option
(
key
=
"file.format"
,
value
=
"parquet"
),
@Option
(
key
=
"snapshot.time-retained"
,
value
=
"10 s"
),
@Option
(
key
=
"snapshot.time-retained"
,
value
=
"10 s"
),
@Option
(
key
=
"partition.expiration-time"
,
value
=
"10min"
),
@Option
(
key
=
"partition.expiration-check-interval"
,
value
=
"2min"
),
@Option
(
key
=
"partition.timestamp-formatter"
,
value
=
"yyyy-MM-dd HH:mm"
),
@Option
(
key
=
"partition.timestamp-pattern"
,
value
=
"$cacheTime"
),
})
})
public
class
CacheData
implements
Serializable
{
public
class
CacheData
implements
Serializable
{
@PartitionKey
private
String
cacheTime
;
@PartitionKey
@PartitionKey
private
String
cacheName
;
private
String
cacheName
;
...
...
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