|
|
@@ -128,9 +128,9 @@ public enum MemoryStorage {
|
|
|
|
|
|
let object: StorageObject<T>
|
|
|
if config.keepWhenEnteringBackground {
|
|
|
- object = BackgroundKeepingStorageObject(value, key: key, expiration: expiration)
|
|
|
+ object = BackgroundKeepingStorageObject(value, expiration: expiration)
|
|
|
} else {
|
|
|
- object = StorageObject(value, key: key, expiration: expiration)
|
|
|
+ object = StorageObject(value, expiration: expiration)
|
|
|
}
|
|
|
storage.setObject(object, forKey: key as NSString, cost: value.cacheCost)
|
|
|
keys.insert(key)
|
|
|
@@ -255,13 +255,11 @@ extension MemoryStorage {
|
|
|
class StorageObject<T> {
|
|
|
var value: T?
|
|
|
let expiration: StorageExpiration
|
|
|
- let key: String
|
|
|
|
|
|
private(set) var estimatedExpiration: Date
|
|
|
|
|
|
- init(_ value: T, key: String, expiration: StorageExpiration) {
|
|
|
+ init(_ value: T, expiration: StorageExpiration) {
|
|
|
self.value = value
|
|
|
- self.key = key
|
|
|
self.expiration = expiration
|
|
|
|
|
|
self.estimatedExpiration = expiration.estimatedExpirationSinceNow
|