Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for go-cache backend #441

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

jbain
Copy link

@jbain jbain commented Aug 28, 2024

This adds support for a simple, ephemeral, in-memory backend. It's a pretty quick proof of concept. I don't have strong opinions for the best way to configure/signal which db backend to use.

Let me know your thoughts!

To run:

 SPIRIT_CONNECTION_URI="asdf" SPIRIT_DB_DRIVER=ephemeral make run

@jbain jbain requested a review from lukewhrit as a code owner August 28, 2024 07:07
@lukewhrit
Copy link
Owner

To keep in line with the other database drivers, I think we can just do SPIRIT_CONNECTION_URI="cache://" or something along those lines.

I do wonder if there is a better library to use since go-cache seems to be unmaintained and if it should be actually be persisted to disk or not? An ephemeral database could be very useful for testing Spacebin in a more robust fashion compared to the current setup.

@jbain
Copy link
Author

jbain commented Sep 3, 2024

SPIRIT_CONNECTION_URI="cache://" works for me, I'll make the change.

re persistence: For my use case I am looking for something that runs entirely within memory with no saved state. It makes testing easy, and also allows for stateless deployments where there is no expectation of persistence.

re: github.com/patrickmn/go-cache it's a pretty basic wrapper around go maps, I've used it in production applications several years, though it has gone fairly stagnant. There may be more modern and feature rich implementations, but this one works well for what it does. If you feel strongly, I can look into other implementations.

@lukewhrit
Copy link
Owner

Sounds good. Frankly, as long as go-cache is stable, I have no problem with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants