stefanwille / crystal-redis

Full featured Redis client for Crystal
MIT License
380 stars 61 forks source link

Support del command to receive an Array of Keys as parameter #82

Closed rodrigopinto closed 5 years ago

rodrigopinto commented 5 years ago

What is this PR for?

This PR is for adding support to the del command to receive an Array of keys as a parameter in addition to the Tuple that already exists. With this implementation, we will be able to do:

# what is possible already with Tuple params
client.del("some", "keys", "here") # => number of delete keys

# after this PR it will also be possible to pass an array
client.del(["some", "keys", "here"]) # => number of delete keys

The documentation generated will look like:

Screen Shot 2019-05-12 at 00 25 06

Additional

The spec for pexpireat was fixed because, the number 1555555555005 used on the expires represents a unix timestamp date for Thursday, April 18, 2019 2:45:55.005 AM which is a past date already. Then, when testing the response from pttl it returned -2 as the key does not exist anymore because the expire time is in the past. Because of this, I changed the test to not be time dependent.

  1. The Unix timestamp can be confirmed here