Skip to content
Permalink
Browse files

fixing the public/internal issues on FutureCache

  • Loading branch information...
Michael Gray
Michael Gray committed Sep 26, 2016
1 parent a4fe1f6 commit 43d4f55387e82e3a0892d346fc1a7018a7a5f15c
@@ -33,8 +33,8 @@
0D7502CE1AE6B29B009C3F63 /* NSFileManager-Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7502CC1AE6B29B009C3F63 /* NSFileManager-Ext.swift */; };
0D7502D01AE6B76D009C3F63 /* NSData-Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7502CF1AE6B76D009C3F63 /* NSData-Ext.swift */; };
0D7502D11AE6B76D009C3F63 /* NSData-Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7502CF1AE6B76D009C3F63 /* NSData-Ext.swift */; };
0D75B9CC1CEB8307002452F6 /* NSCache+FutureKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* NSCache+FutureKit.swift */; };
0D75B9CD1CEB8370002452F6 /* NSCache+FutureKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* NSCache+FutureKit.swift */; };
0D75B9CC1CEB8307002452F6 /* FutureCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* FutureCache.swift */; };
0D75B9CD1CEB8370002452F6 /* FutureCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* FutureCache.swift */; };
0D7CC61F1B390D2500006CBF /* OSFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7CC61E1B390D2500006CBF /* OSFeature.swift */; };
0D7CC6201B390D2500006CBF /* OSFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7CC61E1B390D2500006CBF /* OSFeature.swift */; };
0D8D9A461B36384B003FBADD /* BlockBasedTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D8D9A451B36384B003FBADD /* BlockBasedTestCase.m */; };
@@ -84,12 +84,12 @@
0DBB33341D0F91E40092BF7B /* NSFileManager-Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7502CC1AE6B29B009C3F63 /* NSFileManager-Ext.swift */; };
0DBB33351D0F91E40092BF7B /* NSData-Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7502CF1AE6B76D009C3F63 /* NSData-Ext.swift */; };
0DBB33361D0F91E40092BF7B /* FutureThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DF7A2761B34F0B90031BEA6 /* FutureThread.swift */; };
0DBB33371D0F91E40092BF7B /* NSCache+FutureKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* NSCache+FutureKit.swift */; };
0DBB33371D0F91E40092BF7B /* FutureCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* FutureCache.swift */; };
0DBB333D1D0F91E50092BF7B /* NSOperation+FutureKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DAA4C941B22B3FB0023B02C /* NSOperation+FutureKit.swift */; };
0DBB333E1D0F91E50092BF7B /* NSFileManager-Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7502CC1AE6B29B009C3F63 /* NSFileManager-Ext.swift */; };
0DBB333F1D0F91E50092BF7B /* NSData-Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7502CF1AE6B76D009C3F63 /* NSData-Ext.swift */; };
0DBB33401D0F91E50092BF7B /* FutureThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DF7A2761B34F0B90031BEA6 /* FutureThread.swift */; };
0DBB33411D0F91E50092BF7B /* NSCache+FutureKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* NSCache+FutureKit.swift */; };
0DBB33411D0F91E50092BF7B /* FutureCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D75B9CB1CEB8307002452F6 /* FutureCache.swift */; };
0DDE32651B38BD28007C39D9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDE32641B38BD28007C39D9 /* AppDelegate.swift */; };
0DDE32671B38BD28007C39D9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDE32661B38BD28007C39D9 /* ViewController.swift */; };
0DDE326A1B38BD28007C39D9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0DDE32681B38BD28007C39D9 /* Main.storyboard */; };
@@ -176,7 +176,7 @@
0D7502BF1AE6B182009C3F63 /* OSAtomicInt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = OSAtomicInt.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
0D7502CC1AE6B29B009C3F63 /* NSFileManager-Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSFileManager-Ext.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
0D7502CF1AE6B76D009C3F63 /* NSData-Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSData-Ext.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
0D75B9CB1CEB8307002452F6 /* NSCache+FutureKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSCache+FutureKit.swift"; sourceTree = "<group>"; };
0D75B9CB1CEB8307002452F6 /* FutureCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FutureCache.swift; sourceTree = "<group>"; };
0D7CC61E1B390D2500006CBF /* OSFeature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSFeature.swift; sourceTree = "<group>"; };
0D8D9A431B36384B003FBADD /* FutureKit iOS Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FutureKit iOS Tests-Bridging-Header.h"; sourceTree = "<group>"; };
0D8D9A441B36384B003FBADD /* FutureKit OSX Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FutureKit OSX Tests-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -304,7 +304,7 @@
0D7502CC1AE6B29B009C3F63 /* NSFileManager-Ext.swift */,
0D7502CF1AE6B76D009C3F63 /* NSData-Ext.swift */,
0DF7A2761B34F0B90031BEA6 /* FutureThread.swift */,
0D75B9CB1CEB8307002452F6 /* NSCache+FutureKit.swift */,
0D75B9CB1CEB8307002452F6 /* FutureCache.swift */,
);
path = FoundationExtensions;
sourceTree = "<group>";
@@ -889,7 +889,7 @@
0DBB33141D0F91DA0092BF7B /* Completion.swift in Sources */,
0DBB33181D0F91DA0092BF7B /* Executor.swift in Sources */,
0DBB33291D0F91DF0092BF7B /* ObjectiveCExceptionHandler.m in Sources */,
0DBB33371D0F91E40092BF7B /* NSCache+FutureKit.swift in Sources */,
0DBB33371D0F91E40092BF7B /* FutureCache.swift in Sources */,
0DBB33161D0F91DA0092BF7B /* Promise.swift in Sources */,
0DBB331B1D0F91DA0092BF7B /* Synchronization.swift in Sources */,
);
@@ -916,7 +916,7 @@
0DBB331D1D0F91DB0092BF7B /* Completion.swift in Sources */,
0DBB33211D0F91DB0092BF7B /* Executor.swift in Sources */,
0DBB33301D0F91DF0092BF7B /* ObjectiveCExceptionHandler.m in Sources */,
0DBB33411D0F91E50092BF7B /* NSCache+FutureKit.swift in Sources */,
0DBB33411D0F91E50092BF7B /* FutureCache.swift in Sources */,
0DBB331F1D0F91DB0092BF7B /* Promise.swift in Sources */,
0DBB33241D0F91DB0092BF7B /* Synchronization.swift in Sources */,
);
@@ -974,7 +974,7 @@
092794BC1BB25DD300DFB56D /* Completion.swift in Sources */,
0D7502C41AE6B182009C3F63 /* NSObject-Ext-ThreadSafe.swift in Sources */,
0D7502C81AE6B182009C3F63 /* ObjectiveCExceptionHandler.m in Sources */,
0D75B9CC1CEB8307002452F6 /* NSCache+FutureKit.swift in Sources */,
0D75B9CC1CEB8307002452F6 /* FutureCache.swift in Sources */,
090112C11BD851CB002EB82D /* Tuples.swift in Sources */,
0DEA1BC91AE30885000E126F /* Promise.swift in Sources */,
);
@@ -1001,7 +1001,7 @@
092794BD1BB25DD300DFB56D /* Completion.swift in Sources */,
0D7502C51AE6B182009C3F63 /* NSObject-Ext-ThreadSafe.swift in Sources */,
0D7502C91AE6B182009C3F63 /* ObjectiveCExceptionHandler.m in Sources */,
0D75B9CD1CEB8370002452F6 /* NSCache+FutureKit.swift in Sources */,
0D75B9CD1CEB8370002452F6 /* FutureCache.swift in Sources */,
090112C21BD851CB002EB82D /* Tuples.swift in Sources */,
0DEA1BD61AE30886000E126F /* Promise.swift in Sources */,
);
@@ -21,7 +21,7 @@
"95438028B10BBB846574013D29F154A00556A9D1" : "ReactiveCocoa\/Carthage\/Checkouts\/Nimble\/",
"E084C86B03F81D63323C9E7510697EA528A758C7" : "ReactiveCocoa\/Carthage\/Checkouts\/xcconfigs\/",
"51B210D0D41486D3ADD6940D57E4480BBD4DE4C5" : "ReactiveCocoa\/",
"95DE17A5219F9963BFC5201C57F75BD96CB46948" : "FutureKit",
"95DE17A5219F9963BFC5201C57F75BD96CB46948" : "FutureKit\/",
"B521A9A43F2D8C0BFE65948465239FE1301DA81F" : "ios-cover-pages\/Carthage\/Checkouts\/EasyMapping\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "FutureKit",
@@ -16,17 +16,17 @@ public protocol HasCacheCost {
}


class FutureCacheEntry<T> {
open class FutureCacheEntry<T> {

var future : Future<T>
var expireTime: Date?

init(_ f: Future<T>,expireTime e: Date? = nil) {
public init(_ f: Future<T>,expireTime e: Date? = nil) {
self.future = f
self.expireTime = e
}

init(value: T,expireTime e: Date? = nil) {
public init(value: T,expireTime e: Date? = nil) {
self.future = Future(success: value)
self.expireTime = e
}
@@ -36,6 +36,10 @@ class FutureCacheEntry<T> {

open class FutureCache<KeyType : AnyObject, T> {


public init () {

}
var cache = NSCache<KeyType,FutureCacheEntry<T>>()


@@ -100,7 +104,7 @@ open class FutureCache<KeyType : AnyObject, T> {
}
}

extension FutureCache where T:HasCacheCost {
public extension FutureCache where T:HasCacheCost {

/**
Utlity method for storing "Futures" inside a NSCache

0 comments on commit 43d4f55

Please sign in to comment.
You can’t perform that action at this time.