o_p

joined 2 years ago
[–] [email protected] 6 points 2 years ago

Plant trees? You can check out https://teamtrees.org/

[–] [email protected] 5 points 2 years ago (1 children)

But now what can I spend all this anger on?

[–] [email protected] 2 points 2 years ago

Growing up with a vegan mom and brother the red pie was a staple. Peppers and onions were the go to.

[–] [email protected] 2 points 2 years ago

Sounds like the repository pattern would help here.

I’m doing something similar now where I need to store objects “somewhere”. I have a low level Repository interface to handle persistence that can do the basic CRUD (mainly get/set for my use case). It’s primarily backed by redis, but that same interface has been backed by Postgres, vault, and in-memory caches depending on the need/environment. Works amazingly well.

As a bonus we can create a new Repository to migrate data when needed - such as a redis or postgres upgrade, we build a MigratingRedisRepository that takes in 2 RedisRepository and does the necessary logic of reading from the old and writing to the new.

I think you’re on the right track with a mix of 1&2. Abstract out the data store, it will change some time - and you’ll want to control it for tests too. Let services/managers handle state and delegate down for persistence to wherever that may be.