-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
questionFurther information is requestedFurther information is requested
Description
I have a question regarding the behavior of the buildKey method in SimpleCachePlugin.
Lines 37 to 45 in 4273e00
| private fun buildKey(request: ApplicationRequest, queryKeys: List<String>): String { | |
| val keys = | |
| if (queryKeys.isEmpty()) request.queryParameters else request.queryParameters.filter { key, _ -> key in queryKeys } | |
| val key = "${request.path()}?${ | |
| keys.entries().sortedBy { it.key } | |
| .joinToString("&") { "${it.key}=${it.value.sorted().joinToString(",")}" } | |
| }" | |
| return key.trimEnd('?') | |
| } |
According to the comment in the README:
Cache key will be built only on listed query keys. Others will be ignored!
However, I noticed that even when there are no query parameters, key is still generated. Is this the expected behavior?
I think that the request should only be cached if all the queryKeys are present in the query parameters. If any of the queryKeys isn't present, the request should not be cached.
sample ex:
cacheOutput(6.hours, listOf("id")) { route("random") { ... } }
cache result:
should only cache the one which take the id param
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested
