|
1 | 1 | import Foundation
|
2 | 2 | import PiedPiper
|
3 | 3 |
|
4 |
| -infix operator ?>>: MultiplicationPrecedence |
5 |
| - |
6 | 4 | extension Future {
|
7 | 5 |
|
8 | 6 | /**
|
@@ -43,33 +41,3 @@ extension CacheLevel {
|
43 | 41 | )
|
44 | 42 | }
|
45 | 43 | }
|
46 |
| - |
47 |
| -/** |
48 |
| - Adds a conditioned post-processing step to the results of a fetch closure |
49 |
| - |
50 |
| - As usual, if the transformation fails, the fetch will also fail |
51 |
| - |
52 |
| - - parameter fetchClosure: The closure that will take care of fetching the values |
53 |
| - - parameter conditionedTransformer: The transformer that will be applied to every successful fetch. The transformer gets the key used for the request (where it can apply its condition on) and the fetched value, and has to return the same type of the value. |
54 |
| - The transformation won't be applied when setting values on the cache level, also considering fetch closures don't have a set operation. |
55 |
| - |
56 |
| - - returns: A CacheLevel that incorporates the post-processing step after the fetch |
57 |
| - */ |
58 |
| -public func ?>><A, B, T: ConditionedOneWayTransformer>(fetchClosure: @escaping (_ key: A) -> Future<B>, conditionedTransformer: T) -> BasicCache<A, B> where T.KeyType == A, T.TypeIn == B, T.TypeOut == B { |
59 |
| - return wrapClosureIntoFetcher(fetchClosure).conditionedPostProcess(conditionedTransformer) |
60 |
| -} |
61 |
| - |
62 |
| -/** |
63 |
| - Adds a conditioned post-processing step to the get results of a given CacheLevel |
64 |
| - |
65 |
| - As usual, if the transformation fails, the get request will also fail |
66 |
| - |
67 |
| - - parameter cache: The CacheLevel you want to apply the post-processing step to |
68 |
| - - parameter conditionedTransformer: The transformer that will be applied to every successful fetch. The transformer gets the key used for the request (where it can apply its condition on) and the fetched value, and has to return the same type of the value. |
69 |
| - The transformation won't be applied when setting values on the cache level, also considering fetch closures don't have a set operation. |
70 |
| - |
71 |
| - - returns: A transformed CacheLevel that incorporates the post-processing step |
72 |
| - */ |
73 |
| -public func ?>><A: CacheLevel, T: ConditionedOneWayTransformer>(cache: A, conditionedTransformer: T) -> BasicCache<A.KeyType, A.OutputType> where T.KeyType == A.KeyType, T.TypeIn == A.OutputType, T.TypeOut == A.OutputType { |
74 |
| - return cache.conditionedPostProcess(conditionedTransformer) |
75 |
| -} |
0 commit comments