From bf3c19ad73b549b83faba2693ac38c97fcbbf591 Mon Sep 17 00:00:00 2001 From: Csaba Date: Thu, 26 May 2016 10:37:58 +0200 Subject: [PATCH] Expiry for Arrays --- Pantry/Pantry.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Pantry/Pantry.swift b/Pantry/Pantry.swift index f994a42..3ac58b4 100644 --- a/Pantry/Pantry.swift +++ b/Pantry/Pantry.swift @@ -54,7 +54,7 @@ public class Pantry { - parameter objects: Generic collection of objects that will be stored - parameter key: The objects' key */ - public static func pack(objects: [T], key: String) { + public static func pack(objects: [T], key: String, expires: StorageExpiry = .Never) { let warehouse = getWarehouse(key) var result = [AnyObject]() @@ -62,7 +62,7 @@ public class Pantry { result.append(object.toDictionary()) } - warehouse.write(result, expires: .Never) + warehouse.write(result, expires: expires) } /** @@ -86,7 +86,7 @@ public class Pantry { - SeeAlso: `StorableDefaultType` */ - public static func pack(objects: [T], key: String) { + public static func pack(objects: [T], key: String, expires: StorageExpiry = .Never) { let warehouse = getWarehouse(key) var result = [AnyObject]() @@ -94,7 +94,7 @@ public class Pantry { result.append(object as! AnyObject) } - warehouse.write(result, expires: .Never) + warehouse.write(result, expires: expires) } /** @@ -104,7 +104,7 @@ public class Pantry { - SeeAlso: `StorableDefaultType` */ - public static func pack(objects: [T?], key: String) { + public static func pack(objects: [T?], key: String, expires: StorageExpiry = .Never) { let warehouse = getWarehouse(key) var result = [AnyObject]() @@ -112,7 +112,7 @@ public class Pantry { result.append(object as! AnyObject) } - warehouse.write(result, expires: .Never) + warehouse.write(result, expires: expires) }