You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constKeyv=require('keyv')const{ AzureTableAdapter }=require('keyv-azuretable')constazTableOption={connectionString: '',// connection string for your storage accounttableName: '',// name of the tablenamespace: '',//optional (it's the partition key for the table, if it's empty it will be generated for you)clientOptions: {},// optional (azure-table TableClient-specific options. See note below.)}constnoNsAzTable=newAzureTableAdapter()awaitnoNsAzTable.createTable()// if the table is not created, you can use `createTable` to create the table. If the table already exists, this method will not throw/fail.constconfig=noNsAzTable.getKeyvConfig()// config = {store: azTableAdatpr, namespace: `keyvns-${nanoid()}`}constkeyv=newKeyv(config)constusersAzTable=newAzureTableAdapter({
...azTableOption,namespace: 'users',})// userAzTable = {store: azTableAdapter, namespace: 'users'}constusersKeyv=newKeyv(usersAzTable)//setawaitkeyv.set('foo','bar',6000)//Expiring time is optional (milliseconds)//getconstobj=awaitkeyv.get('foo')//deleteawaitkeyv.delete('foo')//clearawaitkeyv.clear()
Note: clientOptions is the TableClient-specific TableServiceClientOptions object. (See Azure Docs for more details)