Time Since Last Operation¶
Description¶
The Hive system maintains a timer for every key that measures the number of seconds elapsed since the last operation. This operation returns the time calculated by the timer as a number of seconds elapsed since the last operation performed on the specified key.
Method¶
Backendless.Hive(hiveName).[bucketType](keyName).secondsSinceLastOperation(): Promise<number|null>;
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 get the time since last operation for. String value. |
Return Value¶
The number of seconds elapsed since the last operation.
null
if the specified key does not exist.
Example¶
The example below retrieves the number of seconds elapsed since the last operation performed on the 'fruits'
key.
await Backendless.Hive('groceryStore').listStore('fruits').secondsSinceLastOperation()
where:
Argument | Description |
---|---|
'groceryStore' |
Name of a hive where the operation is performed. |
'fruits' |
Key name to get time since the last operation. |
Codeless Reference¶
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. |
key name |
Key name to get the time since last operation for. |
Returns the number of seconds since the last operation. null
if the specified key does not exist.
Consider the following Key Value storage:
The example below gets the time since the last operation for the "Japan"
key:
The output will look as shown below after the Codeless logic runs.