Or with Lua:
EVAL "redis.call('EXPIRE', KEYS[1], ARGV[1]) return redis.call('INCR', KEYS[1])" 1 yourkey 100
Minor point on the Lua example: "incr, expire" may give a slightly different result to "expire, incr" - in the case where the key does not currently exist. I would recommend "incr, expire", but this may require storing the value in a local (presumably it is incr that you want the reply of)
Itamar Haber | Chief Developer Advocate
Redis Watch Newsletter | Curator and Janitor
Redis Labs | ~ of Redis
Mobile: +1 (415) 688 2443
Office: +1 (650) 461 4652
Mobile (IL): +972 (54) 567 9692
Office (IL): +972 (3) 720 8515 Ext. 123
Email: ita...@redislabs.com
Twitter: @itamarhaber
Skype: itamar.haber