Example #1
0
		})
	})

	Describe("#Expire", func() {
		It("calls EXPIRE on the redis connection", func() {
			var getCalled bool
			fakeConnection.RespondToDo(func(command string, args ...interface{}) (interface{}, error) {
				getCalled = true
				Expect(command).To(Equal("EXPIRE"))
				Expect(args[0]).To(HaveLen(2))
				Expect(args[0].([]interface{})[0]).To(Equal("my key"))
				Expect(args[0].([]interface{})[1]).To(Equal(100))

				return int64(1), nil
			})
			val, err := commander.Expire("my key", 100)
			Expect(err).To(BeNil())
			Expect(getCalled).To(BeTrue())
			Expect(val).To(Equal(1))
		})
	})

	Describe("#Exists", func() {
		It("calls EXISTS on the redis connection and returns a bool", func() {
			var existsCalled bool
			fakeConnection.RespondToDo(func(command string, args ...interface{}) (interface{}, error) {
				existsCalled = true
				Expect(command).To(Equal("EXISTS"))
				Expect(args[0]).To(HaveLen(1))
				Expect(args[0].([]interface{})[0]).To(Equal("my key"))