mirror of
https://github.com/hyperoslo/Cache.git
synced 2026-04-07 19:17:36 +00:00
21 lines
469 B
Swift
21 lines
469 B
Swift
import Foundation
|
|
|
|
/// Helper class to hold cached instance and expiry date.
|
|
/// Used in memory storage to work with NSCache.
|
|
class MemoryCapsule: NSObject {
|
|
/// Object to be cached
|
|
let object: Any
|
|
/// Expiration date
|
|
let expiry: Expiry
|
|
|
|
/**
|
|
Creates a new instance of Capsule.
|
|
- Parameter value: Object to be cached
|
|
- Parameter expiry: Expiration date
|
|
*/
|
|
init(value: Any, expiry: Expiry) {
|
|
self.object = value
|
|
self.expiry = expiry
|
|
}
|
|
}
|