Skip to content

Reset Last Operation Time

Description

The Hive system maintains a timer for every key that measures the number of seconds elapsed since the last operation. This operation resets the timer to zero seconds.

Method

// Reset time for one key
Backendless.Hive(hiveName).[bucketType](keyName).touch(): Promise<void>;

// Reset time for multiple keys
Backendless.Hive(hiveName).[bucketType].touch(keys): Promise<void>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
[bucketType] This placeholder must be substituted with one of the following stores types: KeyValueStore, ListStore, MapStore, SetStore, SortedSetStore.
keyName Key name to reset last operation time for. String value.
keys An array of key names for which to reset last operation time. Must be an array of string values.

Return Value

The number of reset timers.

Example

Reset Time For Multiple Keys

The example below resets time since the last operation of the 'fruits' and 'vegetables' keys to 0.

await Backendless.Hive('groceryStore').ListStore.touch(['fruits', 'vegetables'])

where:

Argument                Description
'groceryStore' Name of a hive where the operation is performed.
['fruits','vegetables'] The array of keys in the store to reset time since the last operation.

Reset Time For One Key

The example below resets time since the last operation of the 'fruits' key to 0.

await Backendless.Hive('groceryStore').ListStore('fruits').touch()

where:

Argument                Description
'groceryStore' Name of a hive where the operation is performed. String value.
'fruits' Key name to reset last operation time for.

Codeless Reference
general_api_reset_last_operation_time

where:

Argument                Description
hive name Name of a hive where the operation is performed.
type Storage type, can be one of the following: Key / Value, Sorted Set, Set, Map, List.
keys A list of key names to reset last operation time for.

Consider the following Key Value storage:

sample-key-value

The example below resets time since the last operation for the specified keys:

general_api_example_reset_last_operation_time