Script Development / Simple Storage DFF.STORE
DataFlux Func includes a built-in simple persistent storage feature DFF.STORE
.
For scenarios that require data storage but are not complex, you can directly use this built-in storage feature.
The storage feature follows a Scope-Key-Value
structure, allowing the same Key to exist under different namespaces.
Simple Storage Preserves Original Data Types
When operating on simple storage, the data written is automatically serialized; when reading, it is automatically deserialized.
Therefore, there is no need to manually handle serialization.
DFF.STORE.set(...)
Store data, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
key |
str | Required | Key name |
value |
Any JSON-serializable object | Required | Data |
expires / expire |
int | None |
Expiration time. Unit: seconds None means never expires |
not_exists |
bool | False |
Write only if data does not exist |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 |
|
DFF.STORE.mset(...)
Added in version 6.0.6
Batch store data, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
key_values |
dict | Required | Key-data dictionary |
expires / expire |
int | None |
Expiration time. Unit: seconds None means never expires |
not_exists |
bool | False |
Write only if data does not exist |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 5 |
|
DFF.STORE.keys(...)
Get a list of Keys, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
pattern |
str | "*" |
Key name matching pattern Supports * wildcard |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 |
|
DFF.STORE.get(...)
Get stored data, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
key |
str | Required | Key name |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 |
|
DFF.STORE.mget(...)
Added in version 6.0.6
Batch get stored data, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
keys |
list | Required | List of Key names |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 5 |
|
DFF.STORE.getall(...)
Added in version 6.0.6
Get all stored data, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 5 |
|
DFF.STORE.get_pattern(...)
Added in version 6.0.6
Get stored data based on a key name matching pattern, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
pattern |
str | "*" |
Key name matching pattern Supports * wildcard |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 5 |
|
DFF.STORE.delete(...)
Delete stored data, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
key |
str | Required | Key name |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 |
|
DFF.STORE.delete_pattern(...)
Added in version 6.0.6
Delete stored data based on a key name matching pattern, with the following parameters:
Parameter | Type | Required / Default | Description |
---|---|---|---|
pattern |
str | "*" |
Key name matching pattern Supports * wildcard |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 |
|