I participated in a Redis Hackathon hosted on Dev.to which required use of the Redis Stack. Anyone familiar with Redis knows it for its primary use case as a cache, with popular adoption as a primary database because of its ease-of-use and high developer happiness as part of the ecosystem’s DX metric.
The hackathon started at the beginning of August but I started late and had to balance free time against work time. The submission deadline was August 29 at 7 PM. Though I didn’t have a finalized submission, just for participating I’ve gotten a $500 credit for Redis Stack!
The Redis Stack is a distributed system! Redis has multiple projects, meaning multiple parts of these applications can run in a distributed system to provide a single endpoint for a full-featured cache. Redis means Remote Dictionary server, which is what they call the initial redis
app which is historically compared to memcached
.
Redis Stack is made up of several components, licensed as follows:
Redis Stack Server, which combines open source Redis with RediSearch, RedisJSON, RedisGraph, RedisTimeSeries, and RedisBloom, is licensed under the Redis Source Available License (RSAL).
RedisInsight is licensed under the Server Side Public License (SSPL).
Using these combined systems, I made a microservice app which enabled me to create an endpoint to easily store some data for the michaellamb.dev Discord bot. The project I came up with involved integrating Midjourney image generation and a frontend.
The following sections will be dated entries with commits SHAs and descriptions of the changes.
1 commit
This is just the basic initialization of the app. It builds and runs. Swagger is available.
1 commit
message: creates example People repository
I’m following along with the Stack Spring tutorial here to implement some basic functionality. This includes using the skeleton app repo as a reference.
Progress here includes connecting to the Redis Stack. Of course, the password has been changed since this is open source. A future commit will rename the application.properties
file to indicate it is an example only, after another commit which adds an entry for application.properties
in .gitignore
.
3 commits
message: ignore application.properties
message: Update .gitignore
message: Rename application.properties to last-application.properties
This does the things I said in the last description.
message: migrate to springdoc
Springfox doesn’t support something in Spring 2.7.0 so I migrated the project to Springdoc.
message: replaced import
Fixed an erroneous import in the Person
domain class.
message: implement RedisDocumentRepository operations
This adds functionality around the Person objects using RedisDocumentRepository to generate boilerplate code. We can easily return an Iterable<Person>
with whatever data points we can imagine because of the power of Redis. The OM library gives us the ability to stub basic methods. We can use these to query Redis for data.
message: add controller operations
This exposes the functionality of the PeopleRepository as an API.
message: refactor Person
These chisel down some of the fields on the Person
class
message: remove loadTestData CommandLineRunner
This is tutorial code and should be removed before further development.
message: fix build
I’m not perfect.
I got a good deal of exposure to Redis OM Spring and more experience with RedisInight, the GUI used to inspect Redis databases. I ran into issues with the meta-model generation, I’m not sure if that was because VS Code doesn’t know about meta-modeling or if I was missing a Maven compilation step. Overall, Redis OM Spring seems like it’s headed in a good direction!
My code is not production ready but it’s progress.