Skip to content

Commit 114f266

Browse files
fix: update lru-cache reset method to clear
refs https://github.com/isaacs/node-lru-cache/blob/main/CHANGELOG.md#v7---2022-02 - the `.reset` method became `.clear` in `lru-cache` v7 but the old method was maintained for backward compatibility and given a deprecation warning - without this change, changing user in `node-mysql2` gives the following warning: `(node:27579) [LRU_CACHE_METHOD_reset] DeprecationWarning: The reset method is deprecated. Please use cache.clear() instead.`
1 parent 4e7e9de commit 114f266

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/commands/change_user.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class ChangeUser extends Command {
4444
this.currentConfig.database = this.database;
4545
this.currentConfig.charsetNumber = this.charsetNumber;
4646
connection.clientEncoding = CharsetToEncoding[this.charsetNumber];
47-
// reset prepared statements cache as all statements become invalid after changeUser
48-
connection._statements.reset();
47+
// clear prepared statements cache as all statements become invalid after changeUser
48+
connection._statements.clear();
4949
connection.writePacket(newPacket.toPacket());
5050
// check if the server supports multi-factor authentication
5151
const multiFactorAuthentication = connection.serverCapabilityFlags & ClientConstants.MULTI_FACTOR_AUTHENTICATION;

0 commit comments

Comments
 (0)