mirror of
https://github.com/immich-app/immich.git
synced 2026-03-27 12:20:52 +03:00
re-enable cache
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user