Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit992c6f4

Browse files
committed
Add a caching resource handler for prod
1 parent94e24b3 commit992c6f4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎stubbornjava-common/src/main/java/com/stubbornjava/common/undertow/handlers/CustomHandlers.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
importio.undertow.server.HttpServerExchange;
2323
importio.undertow.server.handlers.ExceptionHandler;
2424
importio.undertow.server.handlers.accesslog.AccessLogHandler;
25+
importio.undertow.server.handlers.cache.DirectBufferCache;
2526
importio.undertow.server.handlers.encoding.ContentEncodingRepository;
2627
importio.undertow.server.handlers.encoding.EncodingHandler;
2728
importio.undertow.server.handlers.encoding.GzipEncodingProvider;
29+
importio.undertow.server.handlers.resource.CachingResourceManager;
2830
importio.undertow.server.handlers.resource.ClassPathResourceManager;
2931
importio.undertow.server.handlers.resource.FileResourceManager;
3032
importio.undertow.server.handlers.resource.ResourceHandler;
@@ -64,7 +66,12 @@ public static HttpHandler resource(String prefix, int cacheTime) {
6466
resourceManager =newFileResourceManager(newFile(path),1024 *1024);
6567
}else {
6668
log.debug("using classpath file resource manager");
67-
resourceManager =newClassPathResourceManager(CustomHandlers.class.getClassLoader(),prefix);
69+
ResourceManagerclassPathManager =newClassPathResourceManager(CustomHandlers.class.getClassLoader(),prefix);
70+
resourceManager =
71+
newCachingResourceManager(100,65536,
72+
newDirectBufferCache(1024,10,10480),
73+
classPathManager,
74+
cacheTime);
6875
}
6976
ResourceHandlerhandler =newResourceHandler(resourceManager);
7077
handler.setCacheTime(cacheTime);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp