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

[REFACTOR]: Create a state store interface compatible with Redis/ValKey etc. #499

Open
acouvreur opened this issue Feb 2, 2025 · 0 comments

Comments

@acouvreur
Copy link
Member

The Store is where the instances are stored for future expiration by the store engine itself.

This mean that any future store implementation must have an expiration mechanism. If the underlying engine does not have one, the store will have to check the engine state on a regular basis.

The interface to implement is:

type Store interface {
	Get(context.Context, string) (instance.State, error)
	Put(context.Context, instance.State, time.Duration) error
	Delete(context.Context, string) error
	OnExpire(context.Context, func(string)) error
}

This allow user to register expiring key notification to stop the related workload on the provider.

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

No branches or pull requests

1 participant