LoginSignup
0
0

Node.js: Redis のデータを削除 (Delete)

Last updated at Posted at 2020-12-30

プログラム

redis_delete.js
#! /usr/local/bin/node
// ---------------------------------------------------------------
//	redis_delete.js
//
//					May/25/2023
//
// ---------------------------------------------------------------
'use strict'

const redis = require('redis')

// ---------------------------------------------------------------
async function delete_proc (options)
{
	var argv = options.argv
	const key_in=argv[2]
	console.log (key_in)

//	const redis = new IORedis()	

	const client = redis.createClient()

	await client.connect()

	await client.del(key_in)

	await client.disconnect()
	console.error ("*** 終了 ***")	
}

// ---------------------------------------------------------------
console.error ("*** 開始 ***")

delete_proc({ argv: process.argv })

// ---------------------------------------------------------------

実行コマンド

./redis_delete.js t1856

確認したバージョン

$ node --version
v20.2.0
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0