In-memory Records
In-memory records can do everything and function just as on disk (device) records do but they exist in the temporary memory of your device (RAM). Redis DB runs in-memory and it is a terrific method to manage certain layers of tiered web app; however, it lacks synchronicity with the data on disk. Redis often serves as a piece of your app and has to be deeply integrated and configured to work proplerly. Standard does this natively and seamlessly. You can do this by prepending the table declaration ([std_name]
) with a $
.
In-memory Tables
To initialize in-memory tables, you must have the standard on disk but you do not need records or an initialized table for that standard. Let's start with an example:
item: ITM {
protected name string NM *
protected price double PR *
}
This standard has two constraints, both of which are required. We can use a standard record creation query to make some items.
[item] + ("Shirt" 25.99)
[item] + ("Pants" 25.99)
We created two records in the item
standard. We can replicate this standard in-memory by calling...
$[item]
We've initialized the table in memory but it is empty. We can replicate the records of the existing on-disk records into RAM by calling...
load $[item]
If we make changes, those changes are only made to the data in memory.
$[item] - <name "Shirt"> #Deletes the shirt
We can sync the in-memory changes to the on-disk records with one simple move...
sync $[ITM]