MemoryCapsule.swift 469 B

123456789101112131415161718192021
  1. import Foundation
  2. /// Helper class to hold cached instance and expiry date.
  3. /// Used in memory storage to work with NSCache.
  4. class MemoryCapsule: NSObject {
  5. /// Object to be cached
  6. let object: Any
  7. /// Expiration date
  8. let expiry: Expiry
  9. /**
  10. Creates a new instance of Capsule.
  11. - Parameter value: Object to be cached
  12. - Parameter expiry: Expiration date
  13. */
  14. init(value: Any, expiry: Expiry) {
  15. self.object = value
  16. self.expiry = expiry
  17. }
  18. }