store.go 703 B

1234567891011121314151617181920212223242526272829
  1. package store
  2. import (
  3. "sync"
  4. "github.com/usememos/memos/server/profile"
  5. )
  6. // Store provides database access to all raw objects.
  7. type Store struct {
  8. Profile *profile.Profile
  9. driver Driver
  10. workspaceSettingCache sync.Map // map[string]*storepb.WorkspaceSetting
  11. userCache sync.Map // map[int]*User
  12. userSettingCache sync.Map // map[string]*storepb.UserSetting
  13. idpCache sync.Map // map[int]*storepb.IdentityProvider
  14. }
  15. // New creates a new instance of Store.
  16. func New(driver Driver, profile *profile.Profile) *Store {
  17. return &Store{
  18. driver: driver,
  19. Profile: profile,
  20. }
  21. }
  22. func (s *Store) Close() error {
  23. return s.driver.Close()
  24. }