dao.go 638 B

123456789101112131415161718192021222324252627282930313233343536
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/job/main/member-cache/conf"
  5. "go-common/library/cache/memcache"
  6. )
  7. // Dao dao
  8. type Dao struct {
  9. c *conf.Config
  10. memberMemcache *memcache.Pool
  11. blockMemcache *memcache.Pool
  12. }
  13. // New init mysql db
  14. func New(c *conf.Config) (dao *Dao) {
  15. dao = &Dao{
  16. c: c,
  17. memberMemcache: memcache.NewPool(c.MemberMemcache),
  18. blockMemcache: memcache.NewPool(c.BlockMemcache),
  19. }
  20. return
  21. }
  22. // Close close the resource.
  23. func (d *Dao) Close() {
  24. d.memberMemcache.Close()
  25. d.blockMemcache.Close()
  26. }
  27. // Ping dao ping
  28. func (d *Dao) Ping(c context.Context) error {
  29. return nil
  30. }