 		it "try to mget with a single key", () ->
 			localCache.mget state.getKeys[0], (err, res) ->
 				state.n++
-				should(err).exist()
+				should.exist err
 				"Error".should.eql err.constructor.name
 				"EKEYSTYPE".should.eql err.name
 				should(res).be.undefined()
 				return
 			return
 
+		it "mget the sub-list", () ->
+			localCache.mget state.getKeys, (err, res) ->
+				state.n++
+				should.not.exist err
+				state.prediction.should.eql res
+				return
+			return
+
+		it "delete keys in the sub-list", () ->
+			localCache.del state.getKeys, (err, count) ->
+				state.n++
+				should.not.exist err
+				state.getKeys.length.should.eql count
+				return
+			return
+
+		it "try to mget the sub-list again", () ->
+			localCache.mget state.getKeys, (err, res) ->
+				state.n++
+				should.not.exist err
+				{}.should.eql res
+				return
+			return
+
+		it "check successful runs", () ->
+			state.n.should.eql state.count + 4
+			return
 		return
 
+
+	describe.only "ttl", () ->
+		before () ->
+			state =
+				n: 0
+				val: randomString 20
+				key1: "k1_#{randomString 20}"
+				key2: "k2_#{randomString 20}"
+				key3: "k3_#{randomString 20}"
+				key4: "k4_#{randomString 20}"
+				key5: "k5_#{randomString 20}"
+				now: Date.now()
+			state.keys = [state.key1, state.key2, state.key3, state.key4, state.key5]
+			return
+
+		it "set a key with ttl", () ->
+			localCache.set state.key1, state.val, 0.5, (err, res) ->
+				should.not.exist err
+				should(res).be.ok()
+
+				ts = localCache.getTtl state.key1
+				if state.now < ts < state.now + 300
+					throw new Error "Invalid timestamp"
+				return
+			return
+
+		it "check this key immediately", () ->
+			localCache.get state.key1, (err, res) ->
+				should.not.exist err
+				state.val.should.eql res
+				return
+			return
+
+		it "before it times out", (done) ->
+			setTimeout(() ->
+				state.n++
+				localCache.get state.key1, (err, res) ->
+					should.not.exist err
+					state.val.should.eql res
+					done()
+					return
+			, 400)
+			return
+
+		it "and after it timed out", (done) ->
+			setTimeout(() ->
+				ts = localCache.getTtl state.key1
+				should.not.exist ts
+
+				state.n++
+				localCache.get state.key1, (err, res) ->
+					should.not.exist err
+					should(res).be.undefined()
+					done()
+					return
+				return
+			, 200)
+			return
+
+		it "set another key with ttl", () ->
+			localCache.set state.key2, state.val, 0.3, (err, res) ->
+				should.not.exist err
+				should(res).be.ok()
+				return
+			return
+
+		it "check this key immediately", () ->
+			localCache.get state.key2, (err, res) ->
+				should.not.exist err
+				state.val.should.eql res
+				return
+			return
+
+		it "before it times out", (done) ->
+			setTimeout(() ->
+				state.n++
+
+				localCache.get state.key2, (err, ts) ->
+					if state.now < ts < state.now + 300
+						throw new Error "Invalid timestamp"
+					return
+
+				localCache.get state.key2, (err, res) ->
+					should.not.exist err
+					state.val.should.eql res
+					done()
+					return
+				return
+			, 250)
+			return
+
+		it "and after it timed out, too", (done) ->
+			setTimeout(() ->
+				ts = localCache.getTtl state.key2
+				should.not.exist ts
+
+				state.n++
+				localCache.get state.key2, (err, res) ->
+					should.not.exist err
+					should(res).be.undefined()
+					done()
+					return
+				return
+			, 100)
+			return
+
+		describe "test the automatic check", (done) ->
+			innerState = null
+
+			before (done) ->
+				setTimeout(() ->
+					innerState =
+						startKeys: localCache.getStats().keys
+						key: "autotest"
+						val: randomString 20
+
+					done()
+					return
+				, 1000)
+				return
+
+			it "set a key with ttl", (done) ->
+				localCache.once "set", (key) ->
+					innerState.key.should.eql key
+					return
+
+				localCache.set innerState.key, innerState.val, 0.5, (err, res) ->
+					should.not.exist err
+					should(res).be.ok()
+					(innerState.startKeys + 1).should.eql localCache.getStats().keys
+					# event handler should have been fired
+					0.should.eql localCache.listenerCount "set"
+					done()
+					return
+				return
+
+			it "and check it's existence", () ->
+				localCache.get innerState.key, (err, res) ->
+					should.not.exist err
+					innerState.val.should.eql res
+					return
+				return
+
+			it "wait for 'expired' event", (done) ->
+				localCache.once "expired", (key, val) ->
+					innerState.key.should.eql key
+					(key not in state.keys).should.eql true
+					should(localCache.data[key]).be.undefined()
+					done()
+					return
+
+				setTimeout(() ->
+					# trigger ttl check, which will trigger the `expired` event
+					localCache._checkData false
+					return
+				, 550)
+				return
+			return
+
+		describe "more ttl tests", () ->
+
+			it "set a third key with ttl", () ->
+				localCache.set state.key3, state.val, 100, (err, res) ->
+					should.not.exist null
+					should(res).be.ok()
+					return
+				return
+
+			it "check it immediately", () ->
+				localCache.get state.key3, (err, res) ->
+					should.not.exist err
+					state.val.should.eql res
+					return
+				return
+
+			it "set ttl to the invalid key", () ->
+				localCache.ttl "#{state.key3}false", 0.3, (err, wasSet) ->
+					should.not.exist err
+					false.should.eql wasSet
+					return
+				return
+
+			it "set ttl to the correct key", () ->
+				localCache.ttl state.key3, 0.3, (err, wasSet) ->
+					should.not.exist err
+					true.should.eql wasSet
+					return
+				return
+
+			it "check if the key still exists", () ->
+				localCache.get state.key3, (err, res) ->
+					should.not.exist err
+					state.val.should.eql res
+					return
+				return
+
+			it "wait until ttl has ended and check if the key was deleted", (done) ->
+				setTimeout(() ->
+					res = localCache.get state.key3
+					should(res).be.undefined()
+					should(localCache.data[state.key3]).be.undefined()
+					done()
+					return
+				, 500)
+				return
+
+			it "set key4 with ttl = 0"
+			it "set key5 with default ttl"
+
+			return
+
+		return
+
 	return

				# 4 char key should not exist
				localCache.get "xxxx", (err, res) ->
					state.n++
					should(err).be.null()
					should(res).be.undefined()
					return


				state.value3.should.eql res
				return
			# delete 2 of those keys
			count = localCache.del keys[0...2]
			2.should.eql count
			# try to get the deleted keys
			keys[0...2].forEach (key) ->
				res = localCache.get key
