Abstract

The Object data structure in JavaScript is simply a set of key-value pairs in which the values for each key must be one of the primitive data types. Developers can add multiple value fields for a given key within a JavaScript Object by using an array as the value. Developers can also use an array as a key and retrieve any value via the array. However, developers must query Objects with whole matching key values which prevents execution of queries with partial or multi-key matching. Overcoming these limitations by storing data in a client-side database on the local disk of a user device is an asynchronous, high latency, and potentially risky operation. This disclosure describes a higher-level data structure called InMemoryStorage that can be used to store data with multiple keys in memory. The values for the keys within the InMemoryStorage data structure can be JavaScript objects, each of which can store its own key-value pairs as usual. Developers can retrieve data from the InMemoryStorage data structure by formulating queries based on keys within the objects stored within it. The techniques can be used for any application that requires synchronous, in-memory, client-side storage and access of data with more than one key, such as batching logs in memory prior to transmitting them to remote persistent storage. The techniques extend JavaScript by adding support for partial and multi-key matching.

Creative Commons License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.

Share

COinS