NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
## renameNx ##### *Description* Same as rename, but will not replace a key if the destination already exists. This is the same behaviour as setNx. 看起来功能和rename是一样的,但是renameNx不是KEY改名的功能,而是复制一个KEY的VALUE到一个新的KEY。是复制出一个新的KEY-VALUE,而VALUE则是srcKEY的VALUE,而不是PHP中的引用概念。 ##### *Example* ``` <pre class="calibre9">$redis->set('x', '42'); $redis->renameNx('x', 'y'); $redis->get('y'); // → 42 $redis->get('x'); // → 42 ``` ``` <pre class="calibre9">$redis->set('x','39'); ``` ``` <pre class="calibre9">$redis->get('x');    //->39 ``` ``` <pre class="calibre9">$redis->get('y');    //->42 ``` ##