- push_tail = { 'RPUSH', _send_bulk },
- push_head = { 'LPUSH', _send_bulk },
- list_length = { 'LLEN', _send_inline, function(response, key)
- --[[ TODO: redis seems to return a -ERR when the specified key does
- not hold a list value, but this behaviour is not
- consistent with the specs docs. This might be due to the
- -ERR response paradigm being new, which supersedes the
- check for negative numbers to identify errors. ]]
- if response == -2 then
- error('Key ' .. key .. ' does not hold a list value')
- end
- return response
- end
- },
- list_range = { 'LRANGE' },
- list_trim = { 'LTRIM' },
- list_index = { 'LINDEX' },
- list_set = { 'LSET', _send_bulk },
- list_remove = { 'LREM', _send_bulk },
- pop_first = { 'LPOP' },
- pop_last = { 'RPOP' },
+ push_tail = bulk('RPUSH'),
+ push_head = bulk('LPUSH'),
+ list_length = inline('LLEN'),
+ list_range = inline('LRANGE'),
+ list_trim = inline('LTRIM'),
+ list_index = inline('LINDEX'),
+ list_set = bulk('LSET'),
+ list_remove = bulk('LREM'),
+ pop_first = inline('LPOP'),
+ pop_last = inline('RPOP'),