title: NSCache behaviour with non-object types
body: <p>The following code works perfectly well, but I am surprised, because I thought <code>NSCache</code> would require object keys &amp; values, and would not take <code>CGFloat</code>s. Can someone explain to me what is happening?</p>
  
  <pre><code>class A
      var cachedPoints = NSCache()
  
      func rAt(theta theta: CGFloat) -&gt; CGFloat {        
          if let r = self.cachedPoints.objectForKey(theta) as? CGFloat {
              return r
          }
          // do some very expensive maths here...
          let r = self.veryExpensiveFunction(theta)
          self.cachedPoints.setObject(r, forKey: theta)
          return r
      }
  }
  </code></pre>