Skip to content

Commit

Permalink
Remove CLDURLCache, CLDImageCache
Browse files Browse the repository at this point in the history
  • Loading branch information
adimiz1 authored Apr 14, 2024
1 parent b4eb75c commit f3b1631
Show file tree
Hide file tree
Showing 55 changed files with 51 additions and 5,866 deletions.
232 changes: 4 additions & 228 deletions Cloudinary.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

66 changes: 7 additions & 59 deletions Cloudinary/Classes/Core/CLDCloudinary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,41 +64,25 @@ public typealias CLDUploadCompletionHandler = (_ response: CLDUploadResult?, _ e

// MARK: Image Cache

/**
Sets Cloudinary SDK's caching policy for images that are downloaded via the SDK's CLDDownloader.
The options are: **None**, **Memory** and **Disk**. default is Disk
*/
open var cachePolicy: CLDImageCachePolicy {
get {
return downloadCoordinator.imageCache.cachePolicy
}
set {
downloadCoordinator.imageCache.cachePolicy = newValue
}
}
open var enableUrlCache: Bool {
get {
return downloadCoordinator.imageCache.cachePolicy == .none
return CLDDownloadCoordinator.enableCache
}
set {
if newValue == true {
downloadCoordinator.imageCache.cachePolicy = .none // turn old cache off
downloadCoordinator.imageCache.maxDiskCapacity = 0 // purge the old cache
}
downloadCoordinator.urlCache.shouldIncludeImages(newValue) // turn on the new cache if true
CLDDownloadCoordinator.enableCache = newValue
}
}

/**
Sets Cloudinary SDK's image cache maximum disk capacity.
default is 150 MB.
*/
open var cacheMaxDiskCapacity: UInt64 {
open var cacheMaxDiskCapacity: Int {
get {
return downloadCoordinator.imageCache.maxDiskCapacity
return CLDDownloadCoordinator.urlCache.diskCapacity
}
set {
downloadCoordinator.imageCache.maxDiskCapacity = newValue
CLDDownloadCoordinator.urlCache.diskCapacity = newValue
}
}

Expand All @@ -108,48 +92,12 @@ public typealias CLDUploadCompletionHandler = (_ response: CLDUploadResult?, _ e
*/
open var cacheMaxMemoryTotalCost: Int {
get {
return downloadCoordinator.imageCache.maxMemoryTotalCost
}
set {
downloadCoordinator.imageCache.maxMemoryTotalCost = newValue
}
}

/**
Sets Cloudinary SDK's asset cache maximum disk capacity.
default is 150 MB.
*/
open var cacheAssetMaxDiskCapacity: Int {
get {
return downloadCoordinator.urlCache.diskCapacity
}
set {
downloadCoordinator.urlCache.updateDiskCapacity(newValue)
}
}

/**
Sets Cloudinary SDK's asset cache maximum memory total cost.
default is 30 MB.
*/
open var cacheAssetMaxMemoryTotalCost: Int {
get {
return downloadCoordinator.urlCache.memoryCapacity
return CLDDownloadCoordinator.urlCache.memoryCapacity
}
set {
downloadCoordinator.urlCache.updateMemoryCapacity(newValue)
CLDDownloadCoordinator.urlCache.memoryCapacity = newValue
}
}

/**
Removes an image from the downloaded images cache, both disk and memory.

- parameter key: The full url of the image to remove.

*/
open func removeFromCache(key: String) {
downloadCoordinator.imageCache.removeCacheImageForKey(key)
}

// MARK: - Init

Expand Down
Loading

0 comments on commit f3b1631

Please sign in to comment.