re-enable cache

This commit is contained in:
mertalev
2026-01-21 18:48:02 -05:00
parent fe07cf6f6d
commit 82dde1c3e7
2 changed files with 4 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ import app.alextran.immich.INITIAL_BUFFER_SIZE
import app.alextran.immich.NativeBuffer import app.alextran.immich.NativeBuffer
import app.alextran.immich.NativeByteBuffer import app.alextran.immich.NativeByteBuffer
import app.alextran.immich.core.SSLConfig import app.alextran.immich.core.SSLConfig
import okhttp3.Cache
import okhttp3.Call import okhttp3.Call
import okhttp3.Callback import okhttp3.Callback
import okhttp3.ConnectionPool import okhttp3.ConnectionPool
@@ -132,7 +133,6 @@ private object ImageFetcherManager {
} }
private fun build(): ImageFetcher { private fun build(): ImageFetcher {
// return OkHttpImageFetcher.create(cacheDir, SSLConfig.sslSocketFactory, SSLConfig.trustManager)
return if (SSLConfig.requiresCustomSSL) { return if (SSLConfig.requiresCustomSSL) {
OkHttpImageFetcher.create(cacheDir, SSLConfig.sslSocketFactory, SSLConfig.trustManager) OkHttpImageFetcher.create(cacheDir, SSLConfig.sslSocketFactory, SSLConfig.trustManager)
} else { } else {
@@ -168,7 +168,7 @@ private class CronetImageFetcher(context: Context, cacheDir: File) : ImageFetche
.enableBrotli(true) .enableBrotli(true)
.setStoragePath(storageDir.absolutePath) .setStoragePath(storageDir.absolutePath)
.setUserAgent(USER_AGENT) .setUserAgent(USER_AGENT)
// .enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK, CACHE_SIZE_BYTES) .enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK, CACHE_SIZE_BYTES)
.build() .build()
} }
@@ -315,7 +315,7 @@ private class OkHttpImageFetcher private constructor(
} }
.dispatcher(Dispatcher().apply { maxRequestsPerHost = MAX_REQUESTS_PER_HOST }) .dispatcher(Dispatcher().apply { maxRequestsPerHost = MAX_REQUESTS_PER_HOST })
.connectionPool(connectionPool) .connectionPool(connectionPool)
// .cache(Cache(File(dir, "thumbnails"), CACHE_SIZE_BYTES)) .cache(Cache(File(dir, "thumbnails"), CACHE_SIZE_BYTES))
if (sslSocketFactory != null && trustManager != null) { if (sslSocketFactory != null && trustManager != null) {
builder.sslSocketFactory(sslSocketFactory, trustManager) builder.sslSocketFactory(sslSocketFactory, trustManager)

View File

@@ -28,7 +28,7 @@ class RemoteImageApiImpl: NSObject, RemoteImageApi {
try! FileManager.default.createDirectory(at: thumbnailPath, withIntermediateDirectories: true) try! FileManager.default.createDirectory(at: thumbnailPath, withIntermediateDirectories: true)
config.urlCache = URLCache( config.urlCache = URLCache(
memoryCapacity: 0, memoryCapacity: 0,
diskCapacity: 0, diskCapacity: 1 << 30,
directory: thumbnailPath directory: thumbnailPath
) )
config.httpMaximumConnectionsPerHost = 16 config.httpMaximumConnectionsPerHost = 16