Improvements to Edge Dictionaries
We’re continuing to build on our unique ability to push your logic and decisions to the edge, and are happy to announce some exciting enhancements to our Edge Dictionaries, which we introduced in August 2015. Edge Dictionaries give you the ability to create dictionaries (key/value pairs that your VCL can reference) inside your Fastly services, helping you make real-time decisions from every server in the Fastly network. Think of it as a globally distributed key/value store with sub-second replication times around the world.
Our latest improvements include Upsert functionality as well as the ability to make bulk updates and issue patch commands. These additions will help you update and create large numbers of dictionary entries with less API calls and more flexibility, while still enforcing granular control over creating and updating entries.
Introducing bulk updates
We’ve added bulk transaction support for dictionary items, giving you the ability to create, update, or delete multiple dictionary items in a single HTTP request. Instead of just modifying one entry at a time, you can now push entries en masse. Bulk updates require fewer API calls and let you interact with your Edge Dictionaries more easily, especially when you have a large amount of entries to update. Note that the bulk update API uses PATCH
HTTP verb along with the /items
resource.
The following actions can be triggered within a bulk update:
Upsert
will create an entry if it doesn’t exist or modify an existing keyCreate
will create a new entry but will not allow an update of existing entriesUpdate
will update an existing entry but will not create new one if it doesn’t existDelete
will permanently delete the entry from the dictionary
Create & update entries with Upsert functionality
Our newly added Upsert functionality lets you create and update entries regardless of whether or not they exist. Previously, sending a PUT
(update) API request to an /item/<key>
resource without first creating the item would result in an error, which wasn’t ideal behavior for a key-value store like an Edge Dictionary (especially with the introduction of bulk update functionality).
We changed the API to utilize the Upsert method, so now when you use the PUT
command it will perform an Upsert. For example, using PUT
will auto-create a key/value pair if the key doesn't already exist in the dictionary, letting you consistently update rows of data in which there may be a mixture of updated and brand-new keys. If you have inconsistent or frequently changing data sets that often add new entries, the PUT
command means you’ll no longer encounter errors when trying to update a record that wasn’t yet created.
Patch command now available for stricter control
If you require more strict control over how entries are uploaded, or prefer the old behavior of the PUT
command, you can take advantage of our newly added PATCH
API request to /item/<key>
resource. With the PATCH
command, you won’t be able to add updates for items that don’t exist, giving you tighter control over what’s created or changed.
Moving forward
These updates will help you implement and manage your Edge Dictionaries more effectively, saving time while providing total control. For more information, check out our updated documentation on Edge Dictionaries, and stay tuned — in an effort to help you make even more dynamic and intelligent decisions at the edge, we’ll be adding some exciting functionality to the Fastly versionless framework in the coming quarter.