     func reset() {
         self.cache.removeAll(keepCapacity: false)
     }
+    
+    // MARK: Private Functions
+    
+    // Not declared private to be visible in unit tests
+    func buildNamespacedKey(key:String, namespace:String?) -> String {
+        var res: String = key
+        
+        if (namespace != nil) && (namespace != "") {
+            res = namespace!+"_"+key
+        }
+        
+        return res
+    }
+    
+    private func ttlExpired(ttl:Double) -> Bool {
+        return CFAbsoluteTimeGetCurrent() > ttl
+    }
 }
typealias CTMemCacheObject = CTMemCacheObjectData



class CTMemCache {
    
    static let sharedInstance = CTMemCache()
    internal var cache: Dictionary<String, CTMemCacheObject>
    
    init() {
        self.cache = [String:CTMemCacheObject]()
    }
    
    func buildNamespacedKey(key:String, namespace:String?) -> String {
        var res: String = key
        
        if (namespace != nil) && (namespace != "") {
            res = namespace!+"_"+key
        }
        
        return res
    }
    
    func set(key: String, data:AnyObject?, namespace:String?="", ttl:Double=86400) {
        var cacheId = self.buildNamespacedKey(key, namespace: namespace)

    
    func size() -> Int {
        return count(self.cache)
    }
    
    // MARK: Clean Functions
    func delete(key:String, namespace:String?="") {
        var cacheId = buildNamespacedKey(key, namespace: namespace)
        self.cache.removeValueForKey(cacheId)
    }
    
    func cleanNamespace(namespace: String) {
