-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
# HEXPIRE | ||
|
||
### Syntax | ||
``` | ||
HEXPIRE key seconds [NX | XX | GT | LT] FIELDS numfields field [field...] | ||
``` | ||
|
||
### Module | ||
<span className="acl-category">hash</span> | ||
|
||
### Categories | ||
<span className="acl-category">fast</span> | ||
<span className="acl-category">hash</span> | ||
<span className="acl-category">write</span> | ||
|
||
### Description | ||
Set an expiration (TTL or time to live) in seconds on one or more fields of a given hash key. | ||
You must specify at least one field. Field(s) will automatically be deleted from the hash key when their TTLs expire. | ||
|
||
### Examples | ||
|
||
<Tabs | ||
defaultValue="go" | ||
values={[ | ||
{ label: 'Go (Embedded)', value: 'go', }, | ||
{ label: 'CLI', value: 'cli', }, | ||
]} | ||
> | ||
<TabItem value="go"> | ||
Set the expiration in seconds for fields in the hash: | ||
```go | ||
db, err := sugardb.NewSugarDB() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
respArray, err := db.HExpire("key", 500, nil, field1, field2) | ||
``` | ||
</TabItem> | ||
<TabItem value="cli"> | ||
Set the expiration in seconds for fields in the hash: | ||
``` | ||
> HEXPIRE key 500 FIELDS 2 field1 field2 | ||
``` | ||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
# HTTL | ||
|
||
### Syntax | ||
``` | ||
HTTL key FIELDS numfields field [field...] | ||
``` | ||
|
||
### Module | ||
<span className="acl-category">hash</span> | ||
|
||
### Categories | ||
<span className="acl-category">fast</span> | ||
<span className="acl-category">hash</span> | ||
<span className="acl-category">read</span> | ||
|
||
### Description | ||
Returns the remaining TTL (time to live) of a hash key's field(s) that have a set expiration. | ||
This introspection capability allows you to check how many seconds a given hash field will continue to be part of the hash key. | ||
|
||
### Examples | ||
|
||
<Tabs | ||
defaultValue="go" | ||
values={[ | ||
{ label: 'Go (Embedded)', value: 'go', }, | ||
{ label: 'CLI', value: 'cli', }, | ||
]} | ||
> | ||
<TabItem value="go"> | ||
Get the expiration time in seconds for fields in the hash: | ||
```go | ||
db, err := sugardb.NewSugarDB() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
TTLArray, err := db.HTTL("key", field1, field2) | ||
``` | ||
</TabItem> | ||
<TabItem value="cli"> | ||
Get the expiration time in seconds for fields in the hash: | ||
``` | ||
> HTTL key FIELDS 2 field1 field2 | ||
``` | ||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters