Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ktor CacheStorage based persistent cache #61

Merged
merged 6 commits into from
Oct 15, 2023

Conversation

psuzn
Copy link
Contributor

@psuzn psuzn commented Sep 20, 2023

This adds a persistent disk cache based on the ktor's CacheStorage. The underlying cache is a disk LRU is a multiplatform port of coil's DiskLruCache (which itself is a port from libcore disklrucache).

HttpCache can be configured as

val httpCacheSize = 1024*1024

KamelConfig {
    imageBitmapCacheSize = DefaultCacheSize
    imageVectorCacheSize = DefaultCacheSize
    svgCacheSize = DefaultCacheSize
    imageBitmapDecoder()
    imageVectorDecoder()
    svgDecoder()
    stringMapper()
    urlMapper()
    uriMapper()
    fileFetcher()
    httpFetcher {
        httpCache(httpCacheSize)
    }
  }

@luca992
Copy link
Member

luca992 commented Sep 20, 2023

Amazing, thanks a lot for the contribution! I've been planning to work on #27 for a while, you've beaten me to it 🙌. I'll review this as soon as I can. In the meantime I can publish a snapshot if you want.

@psuzn
Copy link
Contributor Author

psuzn commented Sep 21, 2023

Please take your time to review it. I had to reorganize the codebase to be able to share the common code between different JVM targets and also specify Android-specific things at the same time. I'm open to any suggestions.

Copy link
Member

@luca992 luca992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Just have a few questions basically.

kamel-image/build.gradle.kts Outdated Show resolved Hide resolved
kamel-core/build.gradle.kts Outdated Show resolved Hide resolved
kamel-core/build.gradle.kts Show resolved Hide resolved
@psuzn psuzn requested a review from luca992 October 15, 2023 14:23
@luca992
Copy link
Member

luca992 commented Oct 15, 2023

Looks good thanks again! @psuzn

@luca992 luca992 merged commit e8c2f5f into Kamel-Media:main Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants