Skip to content

Commit

Permalink
Merge pull request #40 from csabagyarmati/Expiry-for-Arrays
Browse files Browse the repository at this point in the history
Expiry for Arrays
  • Loading branch information
nickoneill committed May 30, 2016
2 parents f879d2b + bf3c19a commit 506794f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Pantry/Pantry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public class Pantry {
- parameter objects: Generic collection of objects that will be stored
- parameter key: The objects' key
*/
public static func pack<T: Storable>(objects: [T], key: String) {
public static func pack<T: Storable>(objects: [T], key: String, expires: StorageExpiry = .Never) {
let warehouse = getWarehouse(key)

var result = [AnyObject]()
for object in objects {
result.append(object.toDictionary())
}

warehouse.write(result, expires: .Never)
warehouse.write(result, expires: expires)
}

/**
Expand All @@ -86,15 +86,15 @@ public class Pantry {

- SeeAlso: `StorableDefaultType`
*/
public static func pack<T: StorableDefaultType>(objects: [T], key: String) {
public static func pack<T: StorableDefaultType>(objects: [T], key: String, expires: StorageExpiry = .Never) {
let warehouse = getWarehouse(key)

var result = [AnyObject]()
for object in objects {
result.append(object as! AnyObject)
}

warehouse.write(result, expires: .Never)
warehouse.write(result, expires: expires)
}

/**
Expand All @@ -104,15 +104,15 @@ public class Pantry {

- SeeAlso: `StorableDefaultType`
*/
public static func pack<T: StorableDefaultType>(objects: [T?], key: String) {
public static func pack<T: StorableDefaultType>(objects: [T?], key: String, expires: StorageExpiry = .Never) {
let warehouse = getWarehouse(key)

var result = [AnyObject]()
for object in objects {
result.append(object as! AnyObject)
}

warehouse.write(result, expires: .Never)
warehouse.write(result, expires: expires)
}


Expand Down

0 comments on commit 506794f

Please sign in to comment.