drush-ops/drush — pull request #307 by kostajh (2013-12-04 20:13:09+00:00)
Title: Fixes for cache-set command

Earlier today, I did the following:

$ drush cache-get my_cache_id my_cache_bin --format=json > /tmp/example.json
$ # In MySQL, deleted the entry for my_cache_id from my_cache_bin.
$ cat /tmp/example.json | drush cache-set my_cache_id - my_cache_bin CACHE_PERMANENT --format=json --cache-get

Reloading the data into the cache failed, for two reasons.

1. Drupal's `cache_set()` (see `set()` in `cache.inc`) complained with this error: "SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'CACHE_PERMANENT' for column 'expire' at row 1"
2. In Drush's `drush_cache_command_set()`, `$data` is assumed to be an object when `cache-get` is specified. But in my case, because I passed `--format=json`, it's an array.

This PR fixes both issues.