Use Data Keys Intelligently
The JavaScript API Class: Data's storage may seem very simple, but with some creativity, it is quite flexible and powerful. The "key" to data entries is indexed by the database, making the "return keys starting with 'x'" queries extremely fast.
- Use prefixes for each use of data entries. For example, if you want to store user data, prefix each entry of this type with "user.". This will allow you to quickly get a list of all user entries with a query for keys starting with "user."
- Include additional data points in the key that will need to be searchable. For example, if you're storing user information in data entries and want to provide a lookup for users by last name, consider include the user's last name in the data key. Remember, the "key starts with" query is much much faster than a "key contains" query. You'll really feel this if your site has a very large number of data entries (like hundreds of thousands).