step 1: delete object using **removeObject**
step 2: save updated object using **setObject**
Every things goes well but the problem appears when try to get data using async.object it returns old value of object.
I have checked value saved on disk it is new data.
I have trace the code and figure out to get data this first check memory :
public func entry(forKey key: Key) throws -> Entry<Value> { do { return try memoryStorage.entry(forKey: key) } catch { let entry = try diskStorage.entry(forKey: key) // set back to memoryStorage memoryStorage.setObject(entry.object, forKey: key, expiry: entry.expiry) return entry } }
how can remove object in first step to make sure it is removed from disk & memory?
Try to update cached object:
Every things goes well but the problem appears when try to get data using async.object it returns old value of object. I have checked value saved on disk it is new data.
I have trace the code and figure out to get data this first check memory :
public func entry(forKey key: Key) throws -> Entry<Value> { do { return try memoryStorage.entry(forKey: key) } catch { let entry = try diskStorage.entry(forKey: key) // set back to memoryStorage memoryStorage.setObject(entry.object, forKey: key, expiry: entry.expiry) return entry } }
how can remove object in first step to make sure it is removed from disk & memory?