Nick Fisher's tech blog

Java

Expiring Individual Elements in a Redis Set

The source code for what follows can be found on Github.

Redis does not allow you to set the expiration on individual members in a set, it only allows you to set an expiration on the entire set itself. If you want to have a sort of expiry on individual elements in a set, this article shares a workaround to that problem that works well in practice. Because I have already written a lot of boilerplate code for testing any redis operation using lettuce, I’m going to be showing you this technique using a reactive lettuce client, however the basic concept should transfer easily to any other client.

Setup and Use a DynamoDB Test Container with the AWS Java SDK 2.0

The source code for this article can be found on Github.

Using embedded dynamodb for testing is, in my experience, kind of flakey and unpredictable. Because of the weird way it pulls in SQLite on a per operating system basis, it can sometimes work locally and not work on the build server. Sometimes it’s just not working for some unexplained reason and wiping the directory that the code is in and re-cloning fixes it. Not a fun time.

Newer Posts