| 1 |
.. _example_token_storage: |
| 2 |
|
| 3 |
Token Storage Adapters |
| 4 |
====================== |
| 5 |
|
| 6 |
DynamoDB Token Storage |
| 7 |
---------------------- |
| 8 |
|
| 9 |
The following example demonstrates a token storage adapter which uses AWS |
| 10 |
DynamoDB as the backend storage mechanism. |
| 11 |
|
| 12 |
Unlike the builtin adapters for JSON and sqlite, there is no capability here |
| 13 |
for an enumeration of all of the tokens in storage. This is because DynamoDB |
| 14 |
functions as a key-value store, and can efficiently map keys, but features slow |
| 15 |
sequential scans for enumeration. The example therefore demonstrates that |
| 16 |
key-value stores with limited or no capabilities for table scans can be used to |
| 17 |
implement the token storage interface. |
| 18 |
|
| 19 |
.. literalinclude:: dynamodb_token_storage.py |
| 20 |
:caption: ``dynamodb_token_storage.py`` [:download:`download <dynamodb_token_storage.py>`] |
| 21 |
:language: python |