New Transposit feature: built-in k/v store
The application stash gives your apps a lightweight, persistent key-value store.
At Transposit we’ve found that even the simplest applications require a modest amount of state tracking. A ton of apps use AirTable, DynamoDB, Google Sheets, or the like to store a tiny bit of data. We wanted to make building apps even easier, so we created the Application Stash, a simple key-value store that is built right into the Transposit platform.
Need to track something like a timestamp? You can accomplish that with just a single line of code using the stash, which is what I ended up doing.
When I was building a Twilio-based application, I needed to aggregate a bunch of incoming messages before sending myself a text digest. I didn’t want my phone to be buzzing more than once every hour, so I used the stash to keep track of a timestamp corresponding to the last time my application actually sent me a text. With this timestamp, I could easily make sure that at least one hour had passed since the last digest.
The gist of my spam minimizing code is here:
How to use it
The programmatic interface to the stash is pretty simple–think Map or dictionary in some common programming languages like Java and Python. Use
stash.put(key, value) to store any value that is JSON-serializable, and use
stash.get(key) to grab it out of the stash later.
Each app actually has two associated stashes: one in development and one for deployed applications. The development context is used when you’re moving fast-and-loose in the management console building, exploring, and iterating on your Transposit operations. Once it’s game time and you’ve deployed a polished operation, then the production context is used whenever deployed operations are executed.
The development stash can be viewed and managed under Code > Development > Stash.
Meanwhile, the production stash is under Deploy > Production Stash (note the different values between the two contexts!).
You can sign in (or sign up!) to start playing with the application stash right now. For more information, check out the docs.
Other potential use cases that would benefit from the stash could be:
- Tracking a cursor indicating how far into a growing CloudWatch logstream your application has processed
- Mapping phone numbers that register with your Twilio-based webhook to people’s names
- Keeping count of the number of times your friends tried and failed to spam your Transposit application
Try out the stash in your own app right now!