-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from hyperoslo/refactor/cache-types
Fix generic Cache class
- Loading branch information
Showing
12 changed files
with
145 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
osx_image: xcode8 | ||
osx_image: xcode8.2 | ||
language: objective-c | ||
|
||
cache: | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
github "krzyzanowskim/CryptoSwift" "0.6.1" | ||
github "Quick/Nimble" "v5.1.0" | ||
github "Quick/Quick" "v0.10.0" | ||
github "krzyzanowskim/CryptoSwift" "0.6.8" | ||
github "Quick/Nimble" "v6.1.0" | ||
github "Quick/Quick" "v1.1.0" |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
HybridCache supports storing all kinds of objects, as long as they conform to | ||
Cachable protocol. It's two layered cache (with front and back storages), as well as Cache. | ||
Subscribes to system notifications to clear expired cached objects. | ||
*/ | ||
public class HybridCache: BasicHybridCache { | ||
|
||
/** | ||
Adds passed object to the front and back cache storages. | ||
- Parameter key: Unique key to identify the object in the cache | ||
- Parameter object: Object that needs to be cached | ||
- Parameter expiry: Expiration date for the cached object | ||
- Parameter completion: Completion closure to be called when the task is done | ||
*/ | ||
public func add<T: Cachable>(_ key: String, object: T, expiry: Expiry? = nil, completion: (() -> Void)? = nil) { | ||
super.add(object, forKey: key, expiry: expiry, completion: completion) | ||
} | ||
|
||
/** | ||
Tries to retrieve the object from to the front and back cache storages. | ||
- Parameter key: Unique key to identify the object in the cache | ||
- Parameter completion: Completion closure returns object or nil | ||
*/ | ||
public func object<T: Cachable>(_ key: String, completion: @escaping (_ object: T?) -> Void) { | ||
super.object(forKey: key, completion: completion) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.