diff --git a/src/ioMethods.ts b/src/ioMethods.ts index 0c151ba..d553701 100644 --- a/src/ioMethods.ts +++ b/src/ioMethods.ts @@ -13,6 +13,7 @@ export const ioMethods = [ 'bitcount', 'bitfield', 'get', + 'getdel', 'getBuffer', 'set', 'setBuffer', diff --git a/test/redis.spec.ts b/test/redis.spec.ts index efe82da..e04d399 100644 --- a/test/redis.spec.ts +++ b/test/redis.spec.ts @@ -281,4 +281,31 @@ test.group('Redis Manager', () => { await redis.del('greeting') await redis.quit() }) + + test('get and delete the key', async ({ assert }) => { + const app = new Application(__dirname, 'web', {}) + const redis = new RedisManager( + app, + { + connection: 'primary', + connections: { + primary: { + host: process.env.REDIS_HOST, + port: Number(process.env.REDIS_PORT), + }, + cluster: { + clusters: clusterNodes, + }, + }, + }, + new Emitter(app) + ) as unknown as RedisManagerContract + + await redis.set('greeting', 'hello-world') + + assert.equal(await redis.getdel('greeting'), 'hello-world') + assert.isUndefined(await redis.get('greeting')) + + await redis.quit('primary') + }) })