         self.entries = [:]
     }
 
-    private func updateFifo(key: String, valueRef: Ref<T>?) {
+    private func updateFifo(key: String, valueRef: Ref<T>) {
         self.fifo.append((key: key, valueRef: valueRef))
         if self.fifo.count >= self.size * self.gcFactor {
-            var newFifo: [(key: String, valueRef: Ref<T>?)] = []
+            var newFifo: [(key: String, valueRef: Ref<T>)] = []
             var need = self.entries
             while need.count > 0 {
                 let fifoEntry = self.fifo.removeLast()

    }

    public func set(#key: String, value: T) -> T {
        if var oldValue = self.entries[key] {
            oldValue = nil
        }

        // register
        let valueRef = Ref<T>(value: value)
        self.entries[key] = Weak<Ref<T>>(value: valueRef)
        self.updateFifo(key, valueRef: valueRef)

        // expire the oldest entry if full
        while self.entries.count > self.size {
            let expireKey = self.fifo.removeAtIndex(0).0
            if self.entries[expireKey]??.value == nil {
                self.entries.removeValueForKey(expireKey)
            }
        }

public class Siegel<T> {
    private let size: Int
    private let gcFactor: Int
    private var fifo: [(key: String, valueRef: Ref<T>)]
    private var entries: [String: Weak<Ref<T>>]

    public init(size: Int = 1024, gcFactor: Int = 10) {
        self.size     = size
