1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.rename = rename;
|
7 |
|
8 | var _keyspaceNotifications = require('../keyspace-notifications');
|
9 |
|
10 | function rename(key, newKey) {
|
11 | var value = this.data.get(key);
|
12 |
|
13 | if (this.expires.has(key)) {
|
14 | var expire = this.expires.get(key);
|
15 | this.expires.delete(key);
|
16 | this.expires.set(newKey, expire);
|
17 | }
|
18 |
|
19 | this.data.set(newKey, value);
|
20 | this.data.delete(key);
|
21 | (0, _keyspaceNotifications.emitNotification)(this, 'g', key, 'rename_from');
|
22 | (0, _keyspaceNotifications.emitNotification)(this, 'g', newKey, 'rename_to');
|
23 | return 'OK';
|
24 | } |
\ | No newline at end of file |