add using lazy connect #122

Merged
vtolstov merged 4 commits from devstigneev/micro-store-redis:lazy_conn into v3 2024-11-27 01:57:41 +03:00
Showing only changes of commit e9a6fb74a0 - Show all commits

View File

@ -56,13 +56,16 @@ var (
)
type Store struct {
opts store.Options
cli goredis.UniversalClient
pool *pool.StringsPool
connected *atomic.Bool
opts store.Options
}
func (r *Store) Connect(ctx context.Context) error {
if r.connected.Load() {
return nil
}
if r.cli == nil {
return store.ErrNotConnected
}