Script Development / Simple Storage DFF.STORE
DataFlux Func includes a built-in simple persistent storage feature DFF.STORE
.
For scenarios where there is a need for data storage but the requirements are not complex, you can directly use this built-in storage feature.
The storage function uses a Scope-Key-Value
structure, allowing the same Key to exist under different namespaces.
Simple storage will maintain the original data type
When operating the simple storage, the written data will be automatically serialized; when reading, it will also be automatically deserialized.
Therefore, no manual serialization processing is required when using it.
DFF.STORE.set(...)
Store data, parameters as follows:
Parameter | Type | Required / Default Value | 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 |
Whether to write only when data does not exist |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 |
|
DFF.STORE.mset(...)
Added in version 6.0.6
Batch store data, parameters as follows:
Parameter | Type | Required / Default Value | Description |
---|---|---|---|
key_values |
dict | Required | Key-data dictionary |
expires / expire |
int | None |
Expiration time. Unit: seconds None means never expires |
not_exists |
bool | False |
Whether to write only when data does not exist |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 5 |
|
DFF.STORE.keys(...)
Get Key list, parameters as follows:
Parameter | Type | Required / Default Value | 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, parameters as follows:
Parameter | Type | Required / Default Value | 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, parameters as follows:
Parameter | Type | Required / Default Value | Description |
---|---|---|---|
keys |
list | Required | Key name list |
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, parameters as follows:
Parameter | Type | Required / Default Value | 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 key name matching pattern, parameters as follows:
Parameter | Type | Required / Default Value | 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, parameters as follows:
Parameter | Type | Required / Default Value | 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 key name matching pattern, parameters as follows:
Parameter | Type | Required / Default Value | Description |
---|---|---|---|
pattern |
str | "*" |
Key name matching pattern Supports * wildcard |
scope |
str | Current script name | Namespace |
Example | |
---|---|
1 2 3 4 |
|