Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filePath to Entry #205

Merged
merged 1 commit into from
Aug 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/Shared/Library/Entry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public struct Entry<T> {
public let object: T
/// Expiry date
public let expiry: Expiry
/// Associated meta data, if any
public let meta: [String: Any]
/// File path to the cached object
public let filePath: String?

init(object: T, expiry: Expiry, meta: [String: Any] = [:]) {
init(object: T, expiry: Expiry, filePath: String? = nil) {
self.object = object
self.expiry = expiry
self.meta = meta
self.filePath = filePath
}
}
6 changes: 1 addition & 5 deletions Source/Shared/Storage/DiskStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,10 @@ extension DiskStorage: StorageAware {
throw StorageError.malformedFileAttributes
}

let meta: [String: Any] = [
"filePath": filePath
]

return Entry(
object: object,
expiry: Expiry.date(date),
meta: meta
filePath: filePath
)
}

Expand Down