The Store provides access to persistent, but not durable, storage.
The Store associates string data - and only string data - with key names. If you'd like to store other data types such as numbers, the data must be converted to a string before writing and back to your desired type after reading.
The Store always returns values in unicode. If it's necessary to convert the unicode object back to a str object, this can be done with the latin-1 codec.
Example using the Store Workflow Library:
Store.set_global_data("key_name", "\xff") val = Store.get_global("key_name") encoded = val.encode("latin-1") assert isinstance(val, unicode) assert "\xff" == encoded assert isinstance(encoded, str)
Keys can either be global for all users or specific to a particular user.
Time to Live
Each key has a time to live that is refreshed whenever the key is set. When the time to live expires, the value of the key is set to None.
Currently the default time to live is one week. To change it to infinite, set ttl=-1.
Key names also have a maximum length of 1000 characters. Data length is limited to 10000 characters.
Key Number Limit
There's a limit of 100 global keys and 100 unique per-user keys, tracked separately. For example, if there's the global key "key 1" set, and user 1 has the per-user keys "key 2" and "key 3" set, and user 2 has the per-user keys "key 3" and "key 4" set, then the global key count is 1 and the unique per-user key count is 3. If any of the limits are exceeded, an exception is thrown.
Also note, that while it is possible to name a global key and a per-user key the same name, this may be confusing when maintaining code.