Skip to content

Latest commit

 

History

History
74 lines (68 loc) · 1.62 KB

Expire.mdx

File metadata and controls

74 lines (68 loc) · 1.62 KB

import { Tabs, Tab } from 'nextra-theme-docs';

Expire

The expire function will set a expire time to a key in redis.

Params

  • Key(*) the name of the key.
  • Seconds(*) the seconds that the key will be alive.
  • Function(OPTIONAL) is the function that will be executed when the query is finished.

Return

If you've specified a function it will return the result of the query in the function, if not it will return the result of the query.

Functions

<Tabs items={["Exports", "Library"]}>

exports["ice_mysql"]:RedisExpire(key, seconds, function)
```lua MySQL.Redis.RedisExpire(key, seconds, function) ```

Use

Awaitable

<Tabs items={["Lua", "JS", "C#"]}>

local result = MySQL.Redis.RedisExpire("name", 60)
```js const result = await MySQL.Redis.RedisExpire("name", 60) ``` ```cs var result = await MySQL.Redis.RedisExpire("name", 60) ```

Callback

  • Callback will return the same as the awaitable function but in the callback function.
  • If the callback is not provided it will return the same as the awaitable function.
  • If you want to make the query to execute in the main thread you have to specify a simple function like this: () => {} to do anything depending on the language. <Tabs items={["Lua", "JS", "C#"]}>
```lua MySQL.Redis.RedisExpire("name", 60, function(result) print(result) end) ``` ```js MySQL.Redis.RedisExpire("name", 60, (result) => { console.log(result) }) ``` ```cs MySQL.Redis.RedisExpire("name", 60, (result) => { Console.WriteLine(result) }) ```