Closed onato closed 5 months ago
The totalCostLimit is correctly set, however, this has no affected on the MemoryStore because there is no cost provided when setting the objects. Hence the NSCache doesn't know what its current cost is and doesn't evict anything.
totalCostLimit
MemoryStore
This line needs to have its cost parameter included. https://github.com/hyperoslo/Cache/blob/520b1afd229e25051878c65ce1e780628ea43b4d/Source/Shared/Storage/MemoryStorage.swift#L44
cost
open class NSCache<KeyType, ObjectType> : NSObject where KeyType : AnyObject, ObjectType : AnyObject { … open func setObject(_ obj: ObjectType, forKey key: KeyType) // 0 cost open func setObject(_ obj: ObjectType, forKey key: KeyType, cost g: Int)
Closing, reason outdated issue.
The
totalCostLimit
is correctly set, however, this has no affected on theMemoryStore
because there is no cost provided when setting the objects. Hence the NSCache doesn't know what its current cost is and doesn't evict anything.This line needs to have its
cost
parameter included. https://github.com/hyperoslo/Cache/blob/520b1afd229e25051878c65ce1e780628ea43b4d/Source/Shared/Storage/MemoryStorage.swift#L44