UNPKG

616 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.rename = rename;
7
8var _keyspaceNotifications = require('../keyspace-notifications');
9
10function 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