Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GGCE
GGCE Server
Commits
72b5807b
Commit
72b5807b
authored
Apr 01, 2022
by
Matija Obreza
Committed by
Artem Hrybeniuk
Apr 01, 2022
Browse files
Admin MVC: Dump cache contents to log
parent
df1e2f75
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/src/main/java/org/gringlobal/mvc/admin/CacheController.java
View file @
72b5807b
...
...
@@ -78,6 +78,24 @@ public class CacheController {
return
"redirect:/admin/cache/"
;
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dump"
)
public
String
dumpCache
(
@RequestParam
(
required
=
true
,
value
=
"name"
)
String
cacheName
)
{
final
Cache
cache
=
cacheManager
.
getCache
(
cacheName
);
if
(
cache
!=
null
)
{
LOG
.
warn
(
"Inspecting cache {} of type {}"
,
cacheName
,
cache
.
getNativeCache
().
getClass
());
var
nativeCache
=
cache
.
getNativeCache
();
if
(
nativeCache
instanceof
IMap
<?,?>)
{
var
hzMap
=
(
IMap
<?,?>)
nativeCache
;
hzMap
.
forEach
((
key
,
value
)
->
{
LOG
.
warn
(
"Key={} [{}]: [{}]\n\t={}"
,
key
,
key
.
getClass
(),
value
.
getClass
(),
value
);
});
}
}
else
{
LOG
.
info
(
"No such cache: {}"
,
cacheName
);
}
return
"redirect:/admin/cache/"
;
}
@RequestMapping
(
"/"
)
public
String
cacheStats
(
Model
model
)
{
List
<
CacheStats
>
cacheMaps
=
new
ArrayList
<
CacheStats
>();
...
...
server/src/main/webapp/WEB-INF/jsp/admin/cache.jsp
View file @
72b5807b
...
...
@@ -32,7 +32,7 @@
<td
style=
"text-align: right;"
>
Efficiency
</td>
<td
class=
"col-
sm-1 col-xs-2
"
>
<td
class=
"col-
xs-1
"
>
<form
class=
"form-inline"
method=
"post"
action=
"
<c:url
value=
"/admin/cache/clearCache"
/>
"
>
<button
type=
"submit"
name=
"clearAll"
class=
"btn btn-warning"
>
Zap!
</button>
...
...
@@ -80,8 +80,8 @@
</p>
</c:if>
</td>
<td
class=
"col-
sm-1 col-xs-2
"
>
<td
class=
"col-
xs-1
"
>
<form
method=
"post"
action=
"
<c:url
value=
"/admin/cache/clearCache"
/>
"
>
<input
type=
"hidden"
name=
"name"
value=
"${cacheMap.name}"
/>
...
...
@@ -91,6 +91,17 @@
value=
"${_csrf.token}"
/>
</form>
</td>
<td
class=
"col-xs-1"
>
<form
method=
"post"
action=
"
<c:url
value=
"/admin/cache/dump"
/>
"
>
<input
type=
"hidden"
name=
"name"
value=
"${cacheMap.name}"
/>
<button
type=
"submit"
class=
"btn btn-default btn-sm"
>
Dump
</button>
<!-- CSRF protection -->
<input
type=
"hidden"
name=
"${_csrf.parameterName}"
value=
"${_csrf.token}"
/>
</form>
</td>
</tr>
</c:forEach>
</tbody>
...
...
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